/* Phone layout. Everything here is scoped to .m-mode (set by mobile.js on narrow screens)
   or to elements that only exist in the phone layout, so the desktop page is unaffected. */

.m-mode #fit { display: none; }
.m-mode body { background: var(--bg); overflow-x: hidden; }
.m-mode body.m-lock { overflow: hidden; }
/* While a film's card is open the page itself doesn't scroll (the card's inner area still does). */
html.m-noscroll { overscroll-behavior: none; }

#m-root { color: var(--ink); font-family: 'Space Mono', monospace; min-height: 100vh; padding-bottom: 28px;
  background-color: var(--bg); background-image: radial-gradient(rgba(255,255,255,.035) 1px, transparent 1.5px); background-size: 7px 7px; }
#m-root button { font-family: inherit; }

/* ---------- fixed header ---------- */
.m-head { position: sticky; top: 0; z-index: 30; padding: 10px 0 10px; background: rgba(20,16,25,.97); transition: box-shadow .2s ease; }
.m-head.scrolled { box-shadow: 0 10px 18px rgba(0,0,0,.6); border-bottom: 2px solid var(--line); }
.m-brand { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px 8px; }
.m-title { margin: 0; font-family: Creepster, cursive; font-weight: 400; font-size: 25px; line-height: 1; letter-spacing: 1px; color: var(--pumpkin); text-shadow: 0 0 12px rgba(255,117,24,.5), 0 3px 0 #3a1406; }
.m-logo { width: 112px; height: auto; display: block; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); }
.m-strip { display: flex; align-items: center; gap: 9px; width: calc(100% - 24px); margin: 0 12px; min-height: 36px; padding: 7px 11px; border: 0; border-radius: 14px; cursor: pointer;
  background-color: var(--card); background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.14) 0 10px, transparent 10px 20px); color: var(--navy); box-shadow: 0 5px 10px rgba(0,0,0,.45); }
.m-strip-name { font-size: 10px; letter-spacing: 1px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-dots { flex: 1; display: grid; grid-template-columns: repeat(31, minmax(0, 1fr)); gap: 2px; }
.m-dots i { aspect-ratio: 1; border-radius: 50%; border: 1.2px solid var(--navy); }
.m-dots i.on { background: var(--bg); }
.m-count { background: var(--navy); color: var(--card); font-family: Anton, sans-serif; font-size: 13px; padding: 3px 7px; border-radius: 5px; line-height: 1; }

/* ---------- cobwebs ---------- */
.m-web { position: absolute; z-index: 2; pointer-events: none; }
.m-web.flip { transform: scaleX(-1); }

/* ---------- special screenings ---------- */
.m-ss { position: relative; overflow: hidden; margin: 12px; padding: 10px 12px 16px; background: var(--panel); border: 2px solid var(--line); border-radius: 12px; }
.m-ss h2 { margin: 0 0 12px; font-family: Anton, sans-serif; font-weight: 400; font-size: 16px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); }
.m-picks { display: flex; justify-content: center; gap: 24px; }
.m-pick { display: flex; flex-direction: column; align-items: center; }
.m-pick-btn { position: relative; padding: 5px; border: 0; border-radius: 5px; background: #0d0b10; box-shadow: inset 0 0 0 2px var(--line), 0 8px 14px rgba(0,0,0,.5); cursor: pointer; transition: transform .25s ease, box-shadow .25s ease; }
.m-pick-btn img { display: block; width: 92px; height: 138px; object-fit: cover; border-radius: 2px; }
.m-pick-btn.watched img { opacity: .4; }
.m-pick-btn.sel { transform: translateY(-8px); box-shadow: inset 0 0 0 2px var(--gold), 0 18px 20px rgba(0,0,0,.7), 0 0 26px rgba(255,226,160,.4); }
.m-night { position: absolute; top: -7px; left: -7px; background: var(--gold); color: var(--bg); font-size: 9px; font-weight: 700; letter-spacing: 1.5px; padding: 3px 7px; transform: rotate(-6deg); }
.m-date { margin-top: -8px; background: var(--gold); color: var(--bg); padding: 4px 10px; border-radius: 3px; transform: rotate(-3deg); font-family: Anton, sans-serif; font-size: 14px; letter-spacing: 1.5px; box-shadow: 0 3px 0 rgba(0,0,0,.35); }
.m-sticker { position: absolute; z-index: 3; display: none; align-items: center; justify-content: center; text-align: center; border-radius: 50%; background: var(--orange); color: var(--bg); font-weight: 700; line-height: 1.1; transform: rotate(-14deg); box-shadow: 0 2px 0 rgba(0,0,0,.4); }
.watched > .m-sticker { display: flex; }
.m-pick-btn .m-sticker { top: 44px; left: 50%; margin-left: -34px; width: 68px; height: 68px; font-size: 10px; }
.m-tape .m-sticker { top: 96px; width: 36px; height: 36px; font-size: 6px; letter-spacing: -.2px; }

/* ---------- shelves ---------- */
.m-unit { margin: 0; padding: 12px 10px 4px; background-color: #3b2718; background-image: repeating-linear-gradient(90deg, rgba(0,0,0,.14) 0 2px, transparent 2px 7px, rgba(255,255,255,.03) 7px 8px, transparent 8px 19px); }
.m-shelf { padding-bottom: 10px; }
.m-bay { position: relative; display: flex; align-items: flex-end; gap: 3px; height: 256px; padding: 0 10px; overflow: hidden;
  background-color: #1a120c; background-image: radial-gradient(ellipse at 50% 0%, rgba(220,205,180,.07), transparent 70%); }
.m-plank { height: 14px; background-color: #6e4a2c; background-image: linear-gradient(rgba(220,205,180,.45), rgba(220,205,180,.45)); background-size: 100% 3px; background-repeat: no-repeat; box-shadow: 0 8px 10px rgba(0,0,0,.5); border-radius: 2px; }
.m-tape { position: relative; flex-shrink: 0; padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: 2px; transition: transform .25s ease, filter .25s ease, box-shadow .25s ease; box-shadow: 3px 0 6px rgba(0,0,0,.45); }
.m-tape img { display: block; border-radius: 2px; }
.m-tape.watched img { opacity: .35; }
.m-cone { display: none; position: absolute; bottom: -4px; left: 50%; width: 170px; margin-left: -85px; height: 280px; z-index: -1; pointer-events: none; background: linear-gradient(to bottom, rgba(255,226,160,.34), rgba(255,226,160,.08)); clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%); }
#m-root.has-sel .m-tape { filter: brightness(.62) saturate(.85); }
#m-root.has-sel .m-tape.sel { z-index: 1; filter: brightness(1.12); transform: translateY(-12px); box-shadow: 0 16px 14px rgba(0,0,0,.65), 0 0 22px rgba(255,226,160,.35); }
.m-tape.sel .m-cone { display: block; }
.m-jack { margin-left: auto; margin-right: 2px; flex-shrink: 0; filter: drop-shadow(0 0 10px rgba(255,150,40,.35)); }

/* ---------- details card ---------- */
.m-card { position: relative; z-index: 5; display: flex; flex-direction: column; box-sizing: border-box; margin: 0 10px 12px; padding: 0 12px;
  background: var(--panel); border: 2px solid var(--line); border-radius: 14px; box-shadow: 0 -10px 24px rgba(0,0,0,.6); overflow: hidden;
  animation: m-card-in .24s ease; transition: transform .22s ease, opacity .22s ease; }
.m-unit .m-card { margin-left: 0; margin-right: 0; }   /* the shelf unit already provides the side gutter */
.m-card.closing { transform: translateY(60px) !important; opacity: 0; }
@keyframes m-card-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.m-handle { flex-shrink: 0; display: flex; justify-content: center; align-items: center; width: 100%; height: 22px; padding: 0; border: 0; background: transparent; cursor: grab; touch-action: none; }
.m-handle span { width: 40px; height: 5px; border-radius: 3px; background: #5a5166; }
.m-top { flex-shrink: 0; display: flex; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.m-poster { width: 100px; height: 150px; object-fit: cover; border-radius: 4px; box-shadow: 0 0 0 2px var(--line); flex-shrink: 0; }
.m-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.m-ftitle { margin: 0; font-family: Anton, sans-serif; font-weight: 400; line-height: 1; letter-spacing: .5px; text-transform: uppercase; white-space: pre-line; overflow-wrap: anywhere; }
.m-year { font-size: 12px; font-weight: 700; letter-spacing: 3px; color: var(--gold); }
.m-rate { display: flex; align-items: center; gap: 5px; }
.m-skulls { display: flex; gap: 1px; }
.m-skull { position: relative; width: 19px; height: 24px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.m-skull .sk-b, .m-skull .sk-f { position: absolute; top: 3px; left: 1px; height: 17px; overflow: hidden; }
.m-skull .sk-b { width: 17px; color: #3a3144; }
.m-skull .sk-f { color: #e8dcc2; }
.m-skull svg { display: block; width: 17px; height: 17px; }
.m-skull .eye, .m-mini .eye, .m-toast-skull .eye, .m-last .eye { fill: var(--panel); }
.m-skull .teeth, .m-mini .teeth, .m-toast-skull .teeth, .m-last .teeth { stroke: var(--panel); stroke-width: 1.4; stroke-linecap: round; }
.m-rate.mine .sk-f { color: var(--orange); }
.m-avg { display: inline-flex; align-items: center; gap: 3px; font-size: 9.5px; color: var(--soft); white-space: nowrap; }
.m-avg b { color: var(--ink); }
.m-mini { width: 12px; height: 12px; color: #e8dcc2; }
.m-watch, .m-comments { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 4px 8px; border-radius: 7px; font-size: 10px; font-weight: 700; letter-spacing: 1px; cursor: pointer; }
.m-watch { margin-top: 3px; border: 0; background: var(--orange); color: var(--bg); box-shadow: 0 3px 0 rgba(0,0,0,.4); }
.m-watch.done { background: var(--teal); }
.m-watch.glow { animation: m-glow 2.5s ease; }
@keyframes m-glow { 0%, 100% { box-shadow: 0 3px 0 rgba(0,0,0,.4); } 15%, 70% { box-shadow: 0 0 0 3px rgba(255,122,26,.35), 0 0 16px rgba(255,122,26,.7); } }
.m-comments { border: 2px solid var(--line); background: #0d0b10; color: var(--ink); }
.m-comments svg { color: var(--teal); }
.m-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 10px 2px 16px 0; }
.m-syn { margin: 0; font-size: 12px; line-height: 1.55; color: #e8dcc2; }
.m-wts { margin: 12px 0 0; font-family: Anton, sans-serif; font-weight: 400; font-size: 15px; letter-spacing: 2px; text-transform: uppercase; color: var(--teal); }
.m-glabel { margin: 8px 0 6px; font-size: 10px; font-weight: 700; letter-spacing: 2px; color: var(--soft); }
.m-tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.m-tile { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 5px 10px 5px 5px; background: #0d0b10; border: 2px solid var(--line); border-radius: 9px; color: var(--ink); text-decoration: none; }
.m-lg { width: 28px; height: 28px; flex-shrink: 0; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-family: Anton, sans-serif; font-size: 13px; object-fit: cover; }
.m-tn { display: block; font-size: 12px; font-weight: 700; }
.m-tp { display: block; font-size: 10px; color: var(--soft); }
.m-note { margin: 12px 0 0; font-size: 10px; color: var(--muted); }
.m-note a { color: var(--soft); }
.m-empty { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

.m-foot { margin: 18px 16px 0; text-align: center; font-size: 11px; color: var(--muted); }

/* ---------- toast ---------- */
.m-toast { position: fixed; left: 50%; bottom: 28px; z-index: 60; display: flex; align-items: center; gap: 9px; padding: 10px 16px; border: 2px solid var(--orange); border-radius: 24px;
  background: #0d0b10; box-shadow: 0 10px 24px rgba(0,0,0,.7); font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: none;
  opacity: 0; transform: translate(-50%, 12px); transition: opacity .2s ease, transform .2s ease; }
.m-toast.show { opacity: 1; transform: translate(-50%, 0); }
.m-toast-skull { width: 16px; height: 16px; color: var(--orange); }

/* ---------- membership card overlay ---------- */
.m-overlay { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px 16px;
  background: rgba(8,6,12,.78); backdrop-filter: blur(2px); opacity: 0; transition: opacity .2s ease; }
.m-overlay[hidden] { display: none; }
.m-overlay.open { opacity: 1; }
.m-x { align-self: flex-end; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: #0d0b10; color: var(--ink); display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.m-mcard { width: min(354px, 100%); box-sizing: border-box; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 11px; border-radius: 16px; transform: rotate(-1.5deg);
  background-color: var(--card); background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.14) 0 10px, transparent 10px 20px); color: var(--navy); box-shadow: 0 16px 30px rgba(0,0,0,.6); }
.m-mc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.m-mc-head img { width: 104px; margin: -6px 0 -6px -6px; }
.m-mc-label { font-family: Anton, sans-serif; font-size: 17px; letter-spacing: 2px; line-height: 1.05; text-align: center; }
.m-mc-count { background: var(--navy); color: var(--card); font-family: Anton, sans-serif; font-size: 19px; padding: 3px 8px; border-radius: 5px; line-height: 1; }
.m-mc-cult { font-size: 12px; letter-spacing: 5px; font-weight: 700; }
.m-mc-fields { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.m-mc-fields .k { opacity: .8; }
.m-mc-fields b { letter-spacing: 1px; }
.m-mc-name { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.m-mc-name input { width: 140px; height: 28px; box-sizing: border-box; padding: 0 6px; border: 2px solid var(--navy); border-radius: 5px; background: #fff4e6; color: var(--navy); font-family: 'Space Mono', monospace; font-weight: 700; font-size: 16px; text-transform: uppercase; }
.m-icon { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: rgba(11,42,111,.14); color: var(--navy); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.m-icon.save { background: var(--navy); color: var(--card); }
.m-mc-punch { background: var(--ink); border-radius: 8px; padding: 9px 11px; }
.m-mc-punch .cap { color: var(--bg); font-size: 10px; font-weight: 700; letter-spacing: 1.5px; margin-bottom: 6px; }
.m-mc-punch .row { display: flex; align-items: center; gap: 7px; }
.m-mc-punch .holes { flex: 1; display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 3px; }
.m-mc-punch .holes i, .m-mc-punch .last { aspect-ratio: 1; border-radius: 50%; border: 1.3px solid var(--navy); }
.m-mc-punch .holes i.on, .m-mc-punch .last.on { background: var(--bg); }
.m-mc-punch .last { width: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #767676; }
.m-last { width: 13px; height: 13px; }

/* ---------- comments panel on phones: full screen, X-only, name above comment ---------- */
.m-mode .drawer { width: 100vw; border-left: 0; }
.m-mode .dr-head { padding: 14px 16px 12px; }
.m-mode .dr-toggle { padding: 9px 16px; }
.m-mode .dr-body { padding: 16px 16px 8px; }
.m-mode .cm-form { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; row-gap: 4px; padding: 10px 16px 20px; }
.m-mode .cm-form > .cm-label, .m-mode .cm-form > .cm-input, .m-mode .cm-form > .cm-error { grid-column: 1 / -1; }
.m-mode .cm-form .cm-row { grid-column: 1; grid-row: 5; margin-top: 6px; }
.m-mode .cm-form .cm-post { grid-column: 2; grid-row: 5; align-self: center; min-height: 40px; padding: 8px 16px; margin-top: 6px; }
.m-mode .cm-form .cm-error { grid-row: 6; min-height: 0; }
.m-mode .cm-input { font-size: 16px; }   /* 16px keeps iPhones from zooming into the field */
.m-mode .cm-text { min-height: 56px; height: 56px; }
.m-mode .cm-count { margin-left: 10px; }

/* Very narrow phones: let the rating label drop under the skulls rather than overflow. */
@media (max-width: 379px) { .m-rate { flex-wrap: wrap; row-gap: 2px; } }

@media (prefers-reduced-motion: reduce) {
  .m-card, .m-tape, .m-pick-btn, .m-toast, .m-overlay { animation: none; transition: none; }
}
