:root {
  --font-display: "Syne", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --ink: #efe7dc;
  --mute: rgba(239, 231, 220, 0.42);
  --line: #2a221b;
  --copper: #d4924a;
  --copper-2: #e8c48a;
  --olive: #9caf7a;
  --clay: #d97857;
  --paper: #0a0908;
  --panel: #171310;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: #0a0908; color: #efe7dc; }
body { font-family: ui-sans-serif, system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.gate {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 4.5rem 1.25rem;
  overflow: hidden;
  background: #0a0908;
}

.gate-bg, .aw-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(212, 146, 74, 0.07), transparent 60%),
    linear-gradient(180deg, #100e0c 0%, #0a0908 45%, #080706 100%);
}
.gate-bg::after, .aw-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(2) infinite;
  pointer-events: none;
}

.gate-marks, .aw-marks {
  position: absolute;
  inset: 18px;
  z-index: 0;
  border: 1px solid rgba(239, 231, 220, 0.06);
  pointer-events: none;
}
.gate-marks::before, .gate-marks::after,
.aw-marks::before, .aw-marks::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(212, 146, 74, 0.45);
}
.gate-marks::before, .aw-marks::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.gate-marks::after, .aw-marks::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }

.gate-bar {
  position: absolute;
  z-index: 2;
  left: 28px;
  right: 28px;
  top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mute);
}
.gate-bar-bottom { top: auto; bottom: 28px; }
.gate-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--olive);
  box-shadow: 0 0 0 0 rgba(156, 175, 122, 0.45);
  animation: live 2.4s ease-out infinite;
}

.gate-boot, .gate-card { position: relative; z-index: 1; }
.gate-boot { display: grid; justify-items: center; text-align: center; }
.gate-boot-mark, .aw-mark {
  display: grid;
  place-items: center;
  border: 1px solid rgba(212, 146, 74, 0.55);
  background: #100e0c;
  color: var(--copper-2);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.12em;
  border-radius: 0;
}
.gate-boot-mark { width: 56px; height: 56px; font-size: 0.95rem; }
.aw-mark { width: 36px; height: 36px; font-size: 0.7rem; }
.gate-boot-label {
  margin: 1rem 0 0;
  color: rgba(239, 231, 220, 0.55);
  letter-spacing: 0.12em;
}
.gate-track {
  width: 160px;
  height: 1px;
  margin: 1.25rem auto 0;
  background: rgba(239, 231, 220, 0.1);
  overflow: hidden;
}
.gate-track span { display: block; height: 100%; background: var(--copper); transition: width 0.55s ease; }

.gate-card {
  width: min(100%, 420px);
  padding: 1.85rem 1.7rem 1.6rem;
  background: rgba(16, 14, 12, 0.72);
  border: 1px solid rgba(239, 231, 220, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.gate-kicker, .aw-kicker {
  margin: 0 0 1.5rem;
  color: var(--copper);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
.gate-field { display: block; margin-bottom: 1rem; }
.gate-field > span:first-child {
  display: block;
  margin-bottom: 0.45rem;
  color: rgba(239, 231, 220, 0.42);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.gate-field:focus-within > span:first-child { color: var(--copper-2); }
.gate-input {
  position: relative;
  display: block;
  background: linear-gradient(180deg, rgba(6, 5, 4, 0.92), rgba(18, 15, 12, 0.55));
  border: 1px solid rgba(239, 231, 220, 0.12);
  clip-path: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px);
}
.gate-input::before {
  content: "";
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 2px;
  background: rgba(212, 146, 74, 0.2);
}
.gate-field:focus-within .gate-input { border-color: rgba(212, 146, 74, 0.45); }
.gate-field:focus-within .gate-input::before { background: var(--copper); }
.gate-field input {
  width: 100%;
  background: transparent;
  border: 0;
  color: #efe7dc;
  padding: 0.88rem 0.95rem 0.88rem 1.05rem;
  outline: none;
  caret-color: var(--copper);
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
}

.gate-submit, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  font-weight: 700;
}
.gate-submit {
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--copper);
  background: var(--copper);
  color: #1a110a;
}
.gate-submit:hover { filter: brightness(1.08); }
.btn {
  border: 1px solid var(--line);
  background: #1c1713;
  color: var(--ink);
  padding: 0.45rem 0.8rem;
}
.btn:hover { border-color: color-mix(in srgb, var(--copper) 55%, var(--line)); color: var(--copper-2); }
.aw-btn-out { background: transparent; border-color: rgba(239, 231, 220, 0.2); }

.gate-error { margin: 0.9rem 0 0; color: var(--clay); font-size: 0.8rem; }
.gate-ok { margin: 0.9rem 0 0; color: var(--olive); font-size: 0.8rem; }

.aw-shell { position: relative; isolation: isolate; min-height: 100vh; }
.aw-bg, .aw-marks { position: fixed; }
.aw-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 70;
  padding: 14px 18px 0;
  background: linear-gradient(180deg, rgba(16, 14, 12, 0.92) 0%, rgba(16, 14, 12, 0.72) 70%, transparent);
}
.aw-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mute);
}
.aw-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.6rem;
  background: linear-gradient(180deg, rgba(22, 18, 15, 0.94), rgba(12, 10, 9, 0.9));
  border: 1px solid rgba(239, 231, 220, 0.12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 236, 210, 0.06);
}
.aw-brand { display: flex; align-items: center; gap: 0.7rem; }
.aw-mark { width: 36px; height: 36px; font-size: 0.72rem; }
.aw-brand strong { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: -0.03em; }
.aw-links {
  display: flex;
  gap: 0.14rem;
  padding: 0.2rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(239, 231, 220, 0.1);
}
.aw-link {
  padding: 0.52rem 0.7rem;
  color: var(--mute);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.aw-link.is-on {
  color: #1a110a;
  background: var(--copper);
  box-shadow: 0 8px 18px rgba(212, 146, 74, 0.18);
}
.aw-session { justify-self: end; }

.aw-main { position: relative; z-index: 1; width: min(980px, calc(100% - 36px)); margin: 0 auto; padding: 8rem 0 4.5rem; }
.aw-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.85rem);
  letter-spacing: -0.045em;
  line-height: 1;
}
.aw-lead { margin: 0.55rem 0 0; max-width: 38rem; color: var(--mute); }
.aw-kicker { margin-bottom: 0.35rem; }

.aw-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 2rem 0 1rem; }
.panel {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(240, 196, 138, 0.05);
  padding: 16px;
}
.aw-stats p, .drop-sub {
  margin: 0 0 8px;
  color: var(--mute);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.aw-stats strong { font-family: var(--font-display); font-size: 22px; }

.publish { padding: 22px; }
.drop {
  min-height: 180px;
  display: grid;
  place-content: center;
  text-align: center;
  margin-bottom: 16px;
  cursor: pointer;
  border: 1px dashed rgba(212, 146, 74, 0.35);
  background: rgba(212, 146, 74, 0.03);
}
.drop.over { border-color: var(--copper); background: rgba(212, 146, 74, 0.08); }
.drop-title { margin: 0 0 8px; font-family: var(--font-display); }
.publish-row {
  display: flex;
  align-items: end;
  gap: 12px;
}
.publish-row .gate-field { margin: 0; width: 150px; }
.btn-copper {
  height: 48px;
  padding: 0 1.15rem;
  background: var(--copper);
  color: #1a110a;
  border: 1px solid var(--copper);
  width: auto;
}
.btn-copper:hover { color: #1a110a; filter: brightness(1.08); }
.btn:disabled, .btn-copper:disabled { opacity: 0.5; cursor: not-allowed; }

.history { margin-top: 1rem; padding: 22px; }
.history h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}
.history-lead { margin: 0.45rem 0 1.1rem; color: var(--mute); }
.history-list { display: grid; }
.history-empty {
  margin: 0;
  padding: 0.4rem 0 0;
  color: var(--mute);
}
.history-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 88px 104px;
  gap: 12px;
  align-items: center;
  padding: 0.9rem 0;
  border-top: 1px solid rgba(239, 231, 220, 0.08);
}
.history-row:first-child { border-top: 0; }
.history-ver {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--copper-2);
}
.history-meta, .history-size {
  margin: 0;
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 12px;
}
.history-live {
  display: inline-flex;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #1a110a;
  background: var(--copper);
  padding: 0.4rem 0.55rem;
}
.history-row .btn { width: 100%; }

.cloud-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 110px 110px;
  gap: 12px;
  margin-bottom: 0.4rem;
}
.cloud-row { margin-top: 0.4rem; align-items: center; }
.cloud-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--mute);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.cloud-check input { accent-color: var(--copper); }

@media (max-width: 720px) {
  .history-row { grid-template-columns: 1fr 1fr; }
  .history-row .btn, .history-live { grid-column: 2; justify-self: end; }
}

@keyframes grain { 0% { transform: translate(0); } 100% { transform: translate(-8px, 6px); } }
@keyframes live {
  0% { box-shadow: 0 0 0 0 rgba(156, 175, 122, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(156, 175, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(156, 175, 122, 0); }
}

@media (max-width: 720px) {
  .aw-stats { grid-template-columns: 1fr; }
  .publish-row { flex-direction: column; align-items: stretch; }
  .publish-row .gate-field { width: 100%; }
  .aw-nav { grid-template-columns: 1fr auto; }
  .aw-links { display: none; }
  .cloud-grid { grid-template-columns: 1fr; }
}
