/* ---- Hat Check: cloakroom claim-ticket theme ---- */

:root {
  --felt: #16261d;
  --felt-dark: #0e1912;
  --felt-line: #24392c;
  --brass: #c9a227;
  --brass-bright: #e7c660;
  --paper: #f3ead3;
  --paper-dim: #e6dabd;
  --ink: #241c14;
  --oxblood: #7a2426;
  --shadow: rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse at top, var(--felt-line) 0%, transparent 60%),
    var(--felt);
  color: var(--paper);
  font-family: "IBM Plex Mono", "Consolas", monospace;
  overflow: hidden;
}

.board {
  max-width: 980px;
  height: 100vh;
  height: 100svh;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
}

/* ---- Header: hanging plaque ---- */

.counter-sign {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  margin-bottom: clamp(0.5rem, 2vh, 1.25rem);
}

.chain-row {
  display: flex;
  gap: 2.5rem;
  margin-bottom: -2px;
  flex: 0 0 auto;
  height: clamp(6px, 3.5vh, 28px);
  overflow: hidden;
}

.chain-link {
  width: 2px;
  height: 28px;
  background: repeating-linear-gradient(
    to bottom,
    var(--brass) 0,
    var(--brass) 4px,
    transparent 4px,
    transparent 8px
  );
}

.plaque {
  background: linear-gradient(180deg, #1c3024 0%, var(--felt) 100%);
  border: 1px solid var(--felt-line);
  border-top: 3px solid var(--brass);
  border-radius: 4px;
  padding: clamp(0.6rem, 3vh, 1.75rem) clamp(1rem, 4vw, 2.5rem) clamp(0.5rem, 2vh, 1.5rem);
  text-align: center;
  box-shadow: 0 12px 30px var(--shadow);
  max-width: 560px;
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: clamp(0.55rem, 1.6vh, 0.7rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
}

.wordmark {
  margin: 0;
  font-family: "Bebas Neue", "Impact", sans-serif;
  font-size: clamp(1.5rem, 6vh, 3.5rem);
  letter-spacing: 0.06em;
  color: var(--paper);
  text-shadow: 0 2px 0 var(--felt-dark);
}

.tagline {
  font-family: "Special Elite", "Courier New", monospace;
  font-size: clamp(0.65rem, 2vh, 0.92rem);
  color: var(--paper-dim);
  margin: clamp(0.25rem, 1vh, 0.6rem) 0 clamp(0.35rem, 1vh, 1rem);
  line-height: 1.4;
}

.counter {
  display: inline-block;
  margin: 0;
  padding: clamp(0.15rem, 0.6vh, 0.3rem) clamp(0.5rem, 1.6vh, 0.9rem);
  border: 1px dashed var(--brass);
  border-radius: 999px;
  font-size: clamp(0.6rem, 1.6vh, 0.75rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-bright);
}

/* ---- Ticket grid ---- */

.ticket-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(11, minmax(36px, 1fr));
  grid-auto-rows: minmax(20px, 52px);
  align-content: center;
  justify-content: center;
  gap: clamp(3px, 0.8vw, 0.6rem);
  overflow: auto;
}

.ticket {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--felt-line);
  border-radius: 6px;
  background: #1a2c21;
  color: inherit;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  container-type: inline-size;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.ticket:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--brass);
  box-shadow: 0 8px 18px var(--shadow);
}

.ticket:focus-visible {
  outline: 2px solid var(--brass-bright);
  outline-offset: 2px;
}

.ticket-stub {
  position: relative;
  flex: 0 0 34%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--brass);
  color: var(--ink);
}

.ticket-stub::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 0;
  bottom: 0;
  width: 10px;
  background-image:
    radial-gradient(circle 4px, var(--felt) 4px, transparent 4.5px);
  background-size: 10px 14px;
  background-repeat: repeat-y;
  background-position: center;
}

.ticket-num {
  font-family: "Bebas Neue", "Impact", sans-serif;
  font-size: clamp(7px, 20cqw, 24px);
  line-height: 1;
}

.ticket-status {
  font-size: clamp(4.5px, 9cqw, 8px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-top: 0.15rem;
  text-align: center;
  white-space: normal;
  line-height: 1.2;
  padding: 0 1px;
  hyphens: none;
  overflow-wrap: break-word;
}

.ticket-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding-left: clamp(1px, 4cqw, 8px);
}

.hat-glyph {
  width: clamp(9px, 22cqw, 26px);
  height: clamp(9px, 22cqw, 26px);
  opacity: 0.35;
}

.hat-glyph path {
  stroke: var(--brass-bright);
  stroke-width: 1.6;
  fill: none;
}

/* claimed state: thumbnail + stamp */

.ticket.claimed .ticket-main {
  background-size: cover;
  background-position: center;
}

.ticket.claimed .ticket-main::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(14, 25, 18, 0.15), rgba(14, 25, 18, 0.75));
}

.claim-stamp {
  position: relative;
  z-index: 1;
  font-family: "Special Elite", monospace;
  font-size: clamp(5.5px, 15cqw, 8.8px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--oxblood);
  background: rgba(243, 234, 211, 0.92);
  padding: clamp(0.6px, 5cqw, 2px) clamp(2px, 12cqw, 5px);
  border: 1px solid var(--oxblood);
  border-radius: 2px;
  transform: rotate(-6deg);
  white-space: nowrap;
}

/* locked state */

.ticket.locked {
  cursor: not-allowed;
  opacity: 0.4;
}

.ticket.locked:hover {
  transform: none;
  border-color: var(--felt-line);
  box-shadow: none;
}

.ticket.locked .ticket-stub {
  background: #6b6b52;
}

/* day-limit state: unlocked but this browser already claimed today */

.ticket.day-limit {
  cursor: not-allowed;
  opacity: 0.55;
}

.ticket.day-limit:hover {
  transform: none;
  border-color: var(--felt-line);
  box-shadow: none;
}

.ticket.day-limit .ticket-stub {
  background: var(--brass-bright);
}

/* ---- Overlay + claim ticket (modal) ---- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 15, 11, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
}

.overlay.hidden { display: none; }

.claim-ticket {
  position: relative;
  display: flex;
  max-width: 720px;
  width: 100%;
  background: var(--paper);
  color: var(--ink);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: ticket-in 0.28s ease-out;
}

@keyframes ticket-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ticket-stub-modal,
.claim-ticket .ticket-stub {
  flex: 0 0 84px;
}

.claim-ticket .ticket-stub {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--brass);
  color: var(--ink);
  padding: 1rem 0.5rem;
}

.claim-ticket .ticket-stub::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 0;
  bottom: 0;
  width: 12px;
  background-image: radial-gradient(circle 5px, var(--paper) 5px, transparent 5.5px);
  background-size: 12px 20px;
  background-repeat: repeat-y;
  background-position: center;
}

.stub-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stub-number {
  font-family: "Bebas Neue", "Impact", sans-serif;
  font-size: 2.4rem;
  line-height: 1;
}

.claim-ticket .ticket-main {
  flex: 1;
  display: block;
  padding: 1.75rem 1.75rem 1.5rem 2rem;
}

.polaroid {
  position: relative;
  background: #fff;
  padding: 0.6rem 0.6rem 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  transform: rotate(-1.2deg);
}

.polaroid img {
  display: block;
  width: 100%;
  max-height: 68vh;
  object-fit: cover;
  border: 1px solid #d8d0bc;
}

.tape {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  width: 64px;
  height: 22px;
  background: rgba(231, 198, 96, 0.55);
  border: 1px solid rgba(201, 162, 39, 0.5);
}

.hat-name {
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  margin: 1rem 0 0;
}

.stub-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  border: 1px solid var(--oxblood);
  background: var(--paper);
  color: var(--oxblood);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.3rem 0.6rem;
  border-radius: 3px;
  cursor: pointer;
}

.stub-close:hover {
  background: var(--oxblood);
  color: var(--paper);
}

.stub-close:focus-visible,
.ticket-grid :focus-visible {
  outline: 2px solid var(--brass-bright);
  outline-offset: 2px;
}

/* ---- Responsive ---- */

@media (max-width: 480px) {
  .wordmark { font-size: 2.6rem; }
  .claim-ticket { flex-direction: column; }
  .claim-ticket .ticket-stub { flex-direction: row; gap: 0.5rem; flex: 0 0 auto; }
  .claim-ticket .ticket-stub::after { display: none; }
  .claim-ticket .ticket-main { padding: 1.25rem 1.25rem 1.5rem; }
}

/* ---- Motion preference ---- */

@media (prefers-reduced-motion: reduce) {
  .claim-ticket { animation: none; }
  .ticket { transition: none; }
}
