:root {
  --yellow: #f2c230;
  --yellow-deep: #e8b420;
  --black: #161311;
  --gold: #b8860b;
  --white: #fdfaf2;
  --card: #fffdf6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Helvetica Neue", Arial, sans-serif;
  background: var(--yellow);
  background-image:
    radial-gradient(circle, rgba(0,0,0,0.10) 1.5px, transparent 1.5px);
  background-size: 18px 18px;
  color: var(--black);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* decorative geometry, matching the reference theme */
.tri {
  position: fixed;
  width: 0; height: 0;
  border-left: 60px solid transparent;
  border-right: 60px solid transparent;
  border-bottom: 100px solid var(--gold);
  opacity: 0.85;
  z-index: 0;
}
.tri-tl { top: -20px; left: -20px; transform: rotate(200deg); }
.tri-br { bottom: -10px; right: 40px; }

.dots-tl {
  position: fixed;
  top: 40px; right: 60px;
  width: 90px; height: 90px;
  background-image: radial-gradient(var(--black) 3px, transparent 3px);
  background-size: 14px 14px;
  opacity: 0.7;
  z-index: 0;
}

.dashcircle {
  position: fixed;
  bottom: 80px; left: 40px;
  width: 130px; height: 130px;
  border-radius: 50%;
  border: 3px dashed var(--black);
  opacity: 0.35;
  z-index: 0;
}

header.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  padding: 20px 5vw;
  border-bottom: 4px solid var(--black);
}

.clapper {
  width: 84px;
  flex-shrink: 0;
}
.clapper-top {
  display: flex;
  height: 22px;
  border: 3px solid var(--black);
  border-bottom: none;
  overflow: hidden;
  transform: skewY(-6deg);
  transform-origin: left bottom;
}
.clapper-top span {
  flex: 1;
  background: var(--black);
}
.clapper-top span:nth-child(even) { background: var(--white); }
.clapper-body {
  height: 52px;
  background: var(--black);
  color: var(--white);
  border: 3px solid var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 2px;
  font-size: 13px;
}

.brand { flex: 1; }
.brand h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: 1px;
  font-weight: 800;
}
.brand p {
  margin: 4px 0 0;
  opacity: 0.75;
  font-size: 14px;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--black);
  color: var(--white);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #999;
  display: inline-block;
}
.dot.ok { background: #3ecf5f; }
.dot.bad { background: #e6493f; }

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: var(--black);
  border: 2px solid var(--black);
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.toggle-thumb {
  position: absolute;
  top: 1px; left: 1px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--white);
  transition: transform 0.15s ease;
}
.toggle input:checked + .toggle-track { background: var(--gold); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--black); outline-offset: 2px; }
.toggle-label { font-size: 13px; font-weight: 600; }

main {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 20px 5vw 24px;
}

@media (min-width: 700px) {
  main {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 22px;
    padding: 28px 5vw 120px;
  }
}

.card {
  min-width: 0;
  background: var(--card);
  border: 3px solid var(--black);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 7px 7px 0 var(--black);
}
.card h2 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.count {
  background: var(--yellow-deep);
  border: 2px solid var(--black);
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 13px;
}

.add-watch form { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.watch-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.watch-field label { font-size: 12.5px; font-weight: 800; }
.watch-field input,
.watch-field select { width: 100%; }
.watch-field-movie,
.watch-field-location { flex: 1 1 100%; }
.add-watch form button { flex: 0 0 auto; }
.watch-field-location select {
  padding-inline-end: 2rem;
}
input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid var(--black);
  border-radius: 8px;
  font-size: 14px;
  background: var(--white);
}
button {
  padding: 10px 16px;
  border: 2px solid var(--black);
  border-radius: 8px;
  background: var(--gold);
  color: var(--black);
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
}
button:hover { background: var(--yellow-deep); }
.hint { font-size: 12.5px; opacity: 0.7; margin: 10px 0 0; }
.empty { font-size: 13px; opacity: 0.6; }

select {
  padding: 10px 10px;
  border: 2px solid var(--black);
  border-radius: 8px;
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
  max-width: 100%;
  min-width: 0;
}

ul { list-style: none; margin: 0; padding: 0; }

.watch-list li, .alert-list li {
  border-bottom: 1px dashed rgba(0,0,0,0.25);
  padding: 10px 0;
}
.watch-list li:last-child, .alert-list li:last-child { border-bottom: none; }

.watch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.watch-row .q { font-weight: 700; }
.watch-row .scope { font-weight: 500; opacity: 0.65; font-size: 12.5px; }
.watch-row button.remove {
  background: var(--black);
  color: var(--white);
  padding: 4px 10px;
  font-size: 12px;
}

.showing-filters { display: flex; gap: 8px; margin-bottom: 12px; }
.showing-filters input { flex: 1; min-width: 0; }
.showing-filters select { flex-shrink: 0; max-width: 45%; }

.showing-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 480px) {
  .showing-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}

@media (min-width: 700px) {
  .showing-grid { max-height: 480px; overflow-y: auto; }
}
.showing-grid li {
  border: 2px solid var(--black);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  gap: 10px;
  background: var(--white);
}
.poster {
  width: 64px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--black);
  flex-shrink: 0;
  background: var(--yellow);
}
.poster-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  color: var(--black);
}
.showing-info { min-width: 0; }
.showing-info .title { font-weight: 700; font-size: 14px; line-height: 1.25; }
.showing-info .meta { font-size: 11.5px; opacity: 0.65; margin-top: 2px; }
.showing-info .cinemas { font-size: 12px; opacity: 0.8; margin-top: 4px; }
.showing-info button {
  margin-top: 8px;
  font-size: 12px;
  padding: 5px 10px;
  background: var(--yellow);
}

.alert-filters { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px;
  border: 2px solid var(--black);
  border-radius: 999px;
  background: var(--white);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.chip.active { background: var(--black); color: var(--white); }

@media (min-width: 700px) {
  .alert-list { max-height: 340px; overflow-y: auto; }
}
.alert-row { display: flex; gap: 10px; align-items: flex-start; }
.poster-sm {
  width: 40px;
  height: 56px;
  object-fit: cover;
  border-radius: 5px;
  border: 2px solid var(--black);
  flex-shrink: 0;
}
.alert-list li .title { font-weight: 800; }
.alert-list li .meta { font-size: 12.5px; opacity: 0.8; margin-top: 2px; }
.alert-list li .badge {
  display: inline-block;
  background: #3ecf5f;
  border: 2px solid var(--black);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
}
.alert-list li .badge-new { background: var(--gold); }

footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 2;
  background: var(--black);
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 5vw;
  font-size: 13px;
}
footer #footerInfo { flex: 1; opacity: 0.85; }
footer button {
  background: var(--gold);
  border-color: var(--yellow);
}
#testResult { font-size: 12px; opacity: 0.85; }

/* ----------------------------------------------------------- mobile ---- */
@media (max-width: 700px) {
  /* decorative geometry only clutters a small viewport - drop it */
  .tri, .dots-tl, .dashcircle { display: none; }

  .clapper { width: 60px; }
  .clapper-body { height: 40px; font-size: 11px; }
  .brand h1 { font-size: 24px; }
  .brand p { font-size: 12.5px; }

  .card { padding: 16px; box-shadow: 5px 5px 0 var(--black); }

  .add-watch form { flex-direction: column; align-items: stretch; }
  .watch-field { width: 100%; }
  .add-watch form input,
  .add-watch form select,
  .add-watch form button { width: 100%; }

  .showing-filters { flex-direction: column; align-items: stretch; }
  .showing-filters select { max-width: 100%; }

  /* bigger tap targets everywhere touch is the only input */
  button, select, input[type="text"] { min-height: 44px; }
  .chip { min-height: 36px; padding: 8px 14px; }
  .toggle-track { width: 42px; height: 24px; }
  .toggle-thumb { width: 18px; height: 18px; }
  .toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }

  /* the fixed bottom bar doesn't work once its content wraps to 2-3 lines -
     let it flow at the end of the page instead */
  footer {
    position: static;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 8px;
  }
  footer #footerInfo { text-align: center; }
  footer button { width: 100%; }
  #testResult { text-align: center; }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(22, 19, 17, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay.modal-entering {
  animation: modal-backdrop-in 180ms ease-out both;
}
.modal-overlay.modal-entering .modal-card {
  animation: modal-ticket-in 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.modal-overlay.unlock-success {
  pointer-events: none;
  animation: unlock-overlay 460ms ease-out forwards;
}
.modal-overlay.unlock-success .modal-card {
  animation: unlock-card 460ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.modal-card {
  width: 100%;
  max-width: 320px;
  background: var(--card);
  border: 3px solid var(--black);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 7px 7px 0 var(--black);
}
.modal-card h3 { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.modal-card p { margin: 0 0 14px; font-size: 13px; opacity: 0.75; }
.modal-card label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 700; }
.modal-card #codeInput {
  width: 100%;
  text-align: center;
  font-size: 20px;
  letter-spacing: 4px;
  margin-bottom: 10px;
}
.modal-card .error { color: #b02a2a; opacity: 1; font-weight: 600; }
.modal-overlay.wrong-number #codeInput {
  border-color: #b02a2a;
  animation: wrong-room 260ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
.modal-actions { display: flex; gap: 8px; }
.modal-actions button { flex: 1; }
.modal-actions button.secondary { background: var(--white); }
.code-success {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}
.code-success[hidden] { display: none; }
.code-success span { font-size: 48px; line-height: 1; animation: popcorn-pop 300ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.code-success strong { font-size: 22px; }
.modal-overlay.unlock-success .unlock-content { display: none; }

@keyframes modal-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-ticket-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97) rotate(-1deg); }
  to { opacity: 1; transform: none; }
}

@keyframes unlock-overlay {
  60% { background: rgba(22, 19, 17, 0.45); }
  100% { background: transparent; opacity: 0; }
}

@keyframes unlock-card {
  35% { transform: scale(1.04) rotate(-1deg); }
  100% { transform: translateY(-10px) scale(0.98); opacity: 0; }
}

@keyframes popcorn-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.6) rotate(-8deg); }
  to { opacity: 1; transform: none; }
}

@keyframes wrong-room {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay.modal-entering,
  .modal-overlay.modal-entering .modal-card,
  .modal-overlay.unlock-success,
  .modal-overlay.unlock-success .modal-card,
  .modal-overlay.wrong-number #codeInput,
  .code-success span {
    animation: none;
  }
}

@media (prefers-color-scheme: dark) {
  body { background: var(--yellow); }
}
