:root {
  --ink: #1f3029;
  --ink-soft: #58655f;
  --paper: #f4efe6;
  --paper-glass: rgba(248, 244, 237, 0.91);
  --pine: #7d522f;
  --pine-light: #b9854d;
  --grass: #4d6646;
  --gold: #f6c75b;
  --rose: #be6f7c;
  --danger: #9e3d35;
  --shadow: 0 18px 60px rgba(24, 36, 30, 0.22);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button, a, input, [tabindex] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  background: #263a30;
}

.venue-shell {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.app-shell.is-map-interactive .venue-shell {
  touch-action: none;
  cursor: grab;
}
.app-shell.is-map-interactive .venue-shell:active { cursor: grabbing; }
.app-shell.is-map-interactive .venue-frame { transition: none; }

.venue-frame {
  position: relative;
  width: min(100vw, calc(100svh * 4 / 3));
  aspect-ratio: 4 / 3;
  transform: scale(var(--scene-zoom, 1));
  transform-origin: var(--scene-origin-x, 50%) var(--scene-origin-y, 50%);
  transition: transform 800ms cubic-bezier(.2,.75,.2,1), filter 500ms ease;
}
.app-shell.is-navigating .venue-frame {
  filter: none;
  will-change: transform;
}

.backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}

.venue-world {
  position: absolute;
  left: 19.3%;
  top: 18.8%;
  width: 62.8%;
  height: 63.5%;
  transform-origin: center;
}

.venue-object { position: absolute; transform-origin: center; }
.stage {
  background: linear-gradient(135deg, #a96732, #d59a59);
  border: 1px solid rgba(68, 40, 20, .6);
  box-shadow: 0 5px 14px rgba(35, 27, 18, .3);
}
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .35;
  background: repeating-linear-gradient(90deg, transparent 0 8%, rgba(64, 34, 14, .45) 8.5% 9%);
}
.bar {
  border-radius: 3px;
  background: linear-gradient(#b87e43, #85532c);
  box-shadow: 0 4px 12px rgba(33, 26, 19, .25);
}
.lounge {
  border: 2px solid rgba(231, 220, 205, .88);
  border-radius: 8px;
  background: rgba(191, 171, 147, .4);
}

.entrance-marker {
  position: absolute;
  z-index: 14;
  width: 1rem;
  height: 1rem;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(31,48,41,.72), 0 3px 12px rgba(20,30,25,.45);
  transform: translate(-15%, -15%);
}
.entrance-marker::after {
  content: "";
  position: absolute;
  left: 72%;
  top: 72%;
  width: 1.25rem;
  height: 3px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(20,30,25,.55);
  transform: rotate(var(--entrance-heading, 40deg));
  transform-origin: left center;
}
.entrance-marker span {
  position: absolute;
  left: 1.55rem;
  top: -.4rem;
  padding: .16rem .42rem;
  border-radius: 999px;
  background: rgba(31,48,41,.9);
  color: #fff;
  font-size: clamp(.48rem, .7vw, .68rem);
  font-weight: 800;
  white-space: nowrap;
}

.table {
  z-index: 5;
  width: 2.5%;
  height: 13.333%;
  min-width: 4px;
  border-radius: 3px;
  background: linear-gradient(90deg, #f8f1e6, #fff 50%, #f1e6d7);
  border: 1px solid rgba(76, 54, 38, .55);
  box-shadow: 0 2px 7px rgba(26, 36, 26, .36);
  transition: filter 300ms ease, box-shadow 300ms ease;
}
.table::before {
  content: "";
  position: absolute;
  inset: 4% 22%;
  background: repeating-linear-gradient(180deg, transparent 0 12%, rgba(126, 82, 47, .2) 13% 14%);
}
.chair {
  position: absolute;
  width: 48%;
  height: 10%;
  border-radius: 2px 2px 35% 35%;
  background: var(--pine-light);
  border: 1px solid rgba(77, 48, 24, .75);
  transition: transform 300ms ease, filter 300ms ease, box-shadow 300ms ease;
}
.chair.left { left: -58%; }
.chair.right { right: -58%; }
.chair::after {
  content: attr(data-letter);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: clamp(5px, .55vw, 10px);
  font-weight: 800;
  text-shadow: 0 1px 2px #533;
  opacity: 0;
}
.app-shell.has-allocation .chair::after { opacity: .85; }

.table-number {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 95%;
  min-width: 0;
  height: auto;
  aspect-ratio: 1;
  padding: 0;
  transform: translate(-50%, -50%) rotate(calc(-1 * var(--table-rotation)));
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 999px;
  background: var(--pine);
  color: #fff;
  font-size: clamp(.45rem, .72vw, .7rem);
  font-weight: 800;
  -webkit-text-stroke: .45px #2f1c12;
  text-shadow:
    -.55px 0 #2f1c12,
    .55px 0 #2f1c12,
    0 -.55px #2f1c12,
    0 .55px #2f1c12;
  white-space: nowrap;
}

.table.is-target {
  z-index: 12;
  filter: brightness(1.22);
  box-shadow: 0 0 0 4px rgba(246,199,91,.9), 0 0 26px 12px rgba(246,199,91,.75);
  animation: table-pulse 1s ease-in-out 2;
}
.chair.is-target {
  z-index: 3;
  filter: brightness(1.32);
}
.chair.is-target::before {
  content: "";
  position: absolute;
  top: -30%;
  width: 190%;
  height: 160%;
  border-top: 3.5px solid #a9572d;
  border-bottom: 3.5px solid #a9572d;
  filter:
    drop-shadow(1px 0 0 #3a2418)
    drop-shadow(-1px 0 0 #3a2418)
    drop-shadow(0 1px 0 #3a2418)
    drop-shadow(0 -1px 0 #3a2418)
    drop-shadow(0 0 5px rgba(169,87,45,.95))
    drop-shadow(0 0 10px rgba(169,87,45,.68));
  animation: seat-marker-pulse 750ms ease-in-out 2;
  pointer-events: none;
}
.chair.left.is-target::before {
  right: -21%;
  border-left: 3.5px solid #a9572d;
  border-radius: .28rem 0 0 .28rem;
}
.chair.right.is-target::before {
  left: -21%;
  border-right: 3.5px solid #a9572d;
  border-radius: 0 .28rem .28rem 0;
}
.overflow-badge {
  position: absolute;
  z-index: 4;
  right: -165%;
  display: grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.15rem;
  padding: 0 .25rem;
  border-radius: 999px;
  background: var(--rose);
  color: #fff;
  font-size: .58rem;
  font-weight: 800;
  box-shadow: 0 0 0 2px #fff, 0 0 14px rgba(190,111,124,.85);
}

@keyframes table-pulse { 50% { filter: brightness(1.45); } }
@keyframes seat-marker-pulse {
  50% {
    opacity: .58;
    transform: scale(1.08);
  }
}

.search-panel {
  position: relative;
  z-index: 30;
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: max(1.5rem, env(safe-area-inset-top)) 1.25rem max(1.5rem, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(31,48,41,.2), rgba(31,48,41,.38));
  transition: opacity 400ms ease, visibility 400ms ease;
}
.event-logo {
  position: absolute;
  top: max(1.25rem, env(safe-area-inset-top));
  left: 50%;
  z-index: 2;
  width: min(9rem, 32vw);
  max-height: 6rem;
  object-fit: contain;
  transform: translateX(-50%);
  filter: drop-shadow(0 4px 16px rgba(18,30,24,.28));
}
.app-shell.has-allocation .search-panel,
.app-shell.is-navigating .search-panel { opacity: 0; visibility: hidden; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .venue-frame,
  .search-panel,
  .table,
  .chair { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
.app-shell:not(.has-allocation):not(.is-navigating) .venue-frame {
  filter: saturate(.78) brightness(.8);
}

.word-cloud {
  position: absolute;
  inset: 0;
  max-width: 68rem;
  margin: auto;
  color: rgba(255,255,255,.84);
  pointer-events: none;
}
.word { position: absolute; text-shadow: 0 2px 20px rgba(16,26,21,.45); }
.word-en { top: 18%; left: 9%; font-size: clamp(1.9rem, 5.5vw, 5.4rem); font-weight: 650; }
.word-el { top: 66%; right: 6%; font-size: clamp(1.25rem, 3.3vw, 3.2rem); }
.word-ro { top: 30%; right: 8%; font-size: clamp(1rem, 2.2vw, 2.15rem); opacity: .82; }

.search-box { position: relative; width: min(92vw, 35rem); }
#guest-search {
  width: 100%;
  min-height: 4.2rem;
  padding: 0 1.35rem;
  border: 1px solid rgba(255,255,255,.68);
  border-radius: 1.2rem;
  background: var(--paper-glass);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: max(1rem, 16px);
}
#guest-search::placeholder { color: #68726d; }
.suggestions {
  position: absolute;
  top: calc(100% + .55rem);
  left: 0;
  right: 0;
  max-height: min(44svh, 24rem);
  overflow-y: auto;
  border-radius: 1rem;
  background: rgba(250,247,241,.97);
  box-shadow: var(--shadow);
}
.suggestion {
  display: block;
  width: 100%;
  min-height: 3.65rem;
  padding: .72rem 1rem;
  border: 0;
  border-bottom: 1px solid rgba(31,48,41,.1);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.suggestion:hover, .suggestion[aria-selected="true"] { background: #eee2d2; }
.suggestion strong { display: block; font-size: 1rem; font-weight: 650; }
.suggestion small { display: block; margin-top: .18rem; color: var(--ink-soft); }
.search-status { min-height: 1.3rem; margin: .6rem .25rem 0; color: #fff; text-shadow: 0 1px 4px #1c2a23; }

.back-button {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  left: max(1rem, env(safe-area-inset-left));
  z-index: 50;
  width: 3rem;
  height: 3rem;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 999px;
  background: rgba(31,48,41,.84);
  color: #fff;
  font-size: 1.45rem;
  box-shadow: var(--shadow);
}
.allocation-card {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  z-index: 50;
  width: min(21rem, calc(100vw - 5.3rem));
  max-height: min(45svh, 28rem);
  overflow: auto;
  padding: 1rem 1.05rem;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 1.15rem;
  background: var(--paper-glass);
  box-shadow: var(--shadow);
}
.allocation-card h2 { margin: 0; font-size: 1.2rem; }
.allocation-card .primary-allocation { margin: .25rem 0 .65rem; color: var(--pine); font-size: 1.05rem; font-weight: 800; }
.allocation-list { display: grid; gap: .4rem; margin: .5rem 0 0; padding: 0; list-style: none; }
.allocation-list li { display: flex; justify-content: space-between; gap: 1rem; padding-top: .4rem; border-top: 1px solid rgba(31,48,41,.12); font-size: .86rem; }
.map-hint {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 45;
  margin: 0;
  padding: .48rem .75rem;
  border: 1px solid rgba(255,255,255,.62);
  border-radius: 999px;
  background: rgba(31,48,41,.78);
  color: #fff;
  font-size: .76rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(20,30,25,.22);
  transform: translateX(-50%);
  pointer-events: none;
}
.admin-link {
  position: fixed;
  right: max(.75rem, env(safe-area-inset-right));
  bottom: max(.65rem, env(safe-area-inset-bottom));
  z-index: 20;
  color: rgba(255,255,255,.55);
  font-size: .7rem;
  text-decoration: none;
}

.admin-body { min-height: 100svh; background: linear-gradient(135deg, #eef0e8, #f5ecdf); }
.admin-shell { width: min(72rem, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 4rem; }
.admin-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.admin-header h1 { margin: .15rem 0; font-size: clamp(2rem, 5vw, 4rem); line-height: 1; }
.admin-header p { margin: .25rem 0; color: var(--ink-soft); }
.eyebrow { color: var(--pine) !important; font-size: .78rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.text-link { min-height: 44px; display: inline-flex; align-items: center; color: var(--ink); }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.admin-card {
  margin-bottom: 1rem;
  padding: 1.3rem;
  border: 1px solid rgba(31,48,41,.13);
  border-radius: 1rem;
  background: rgba(255,255,255,.74);
  box-shadow: 0 10px 35px rgba(31,48,41,.08);
}
.admin-card h2 { margin: 0 0 1rem; font-size: 1.1rem; }
.auth-card { max-width: 32rem; margin: 8svh auto 0; }
.admin-card form { display: grid; gap: .65rem; }
.admin-card label { font-size: .84rem; font-weight: 750; }
.admin-card input[type="text"], .admin-card input[type="date"], .admin-card input[type="password"] {
  width: 100%;
  min-height: 3rem;
  padding: .6rem .75rem;
  border: 1px solid rgba(31,48,41,.25);
  border-radius: .65rem;
  background: #fff;
  font-size: 16px;
}
.drop-zone {
  display: grid;
  place-items: center;
  min-height: 7rem;
  padding: 1rem;
  border: 2px dashed rgba(31,48,41,.35);
  border-radius: .8rem;
  background: rgba(240,235,225,.65);
  color: var(--ink-soft);
  text-align: center;
  cursor: pointer;
}
.drop-zone.large { min-height: 11rem; }
.drop-zone.is-dragging { border-color: var(--pine); background: #eadac4; }
.logo-preview { max-width: 12rem; max-height: 7rem; object-fit: contain; }
.button-row { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }
.primary-button, .secondary-button, .danger-button {
  min-height: 44px;
  padding: .65rem 1rem;
  border-radius: .65rem;
  font-weight: 750;
  cursor: pointer;
}
.primary-button { border: 1px solid var(--ink); background: var(--ink); color: #fff; }
.secondary-button { border: 1px solid rgba(31,48,41,.35); background: #fff; color: var(--ink); }
.danger-button { border: 1px solid var(--danger); background: transparent; color: var(--danger); }
button:disabled { cursor: not-allowed; opacity: .45; }
.form-status { min-height: 1.4rem; color: var(--danger); }
.import-summary { margin-top: .8rem; font-size: .88rem; }
.import-summary ul { padding-left: 1.2rem; }
.import-summary .ok { color: #286d4b; font-weight: 750; }
.import-summary .error { color: var(--danger); font-weight: 750; }
.system-list { margin: 0; }
.system-list div { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid rgba(31,48,41,.1); }
.system-list dt { color: var(--ink-soft); }
.system-list dd { margin: 0; font-weight: 750; text-align: right; }

@media (max-width: 740px) {
  .venue-frame { width: auto; height: 100svh; aspect-ratio: 4 / 3; }
  .word-en { top: 17%; left: 5%; }
  .word-el { top: 69%; right: 4%; }
  .word-ro { top: 28%; right: 5%; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-shell { padding-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
