:root {
  --chassis: #1a1916;
  --panel: #24221d;
  --well: #f3ede0;
  --ink: #1f1b16;
  --mute: #8a8070;
  --hair: #3d3a32;
  --amber: #e3a008;
  --live: #7cba5a;
  --danger: #d4533c;
  --focus: #e3a008;
  --tab: #2c2923;
  --chrome-h: 86px;
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--chassis);
  color: var(--well);
  font-family: var(--sans);
}

body {
  min-height: 100dvh;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--well);
  color: var(--ink);
}

.skip:focus {
  top: 12px;
}

.shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.chrome {
  flex: 0 0 auto;
  background: var(--chassis);
  border-bottom: 1px solid var(--hair);
  padding: 6px 10px 8px;
  padding-top: max(6px, env(safe-area-inset-top));
}

.tabstrip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}

.clock {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid #6d5014;
  border-radius: 10px;
  background:
    radial-gradient(80px 28px at 10% 0%, rgba(227, 160, 8, 0.18), transparent 70%),
    linear-gradient(180deg, #33270e 0%, #1f180b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 214, 120, 0.16),
    0 6px 16px rgba(0, 0, 0, 0.22);
  color: var(--well);
}

.clock-kicker {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
}

.clock-stack {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.clock-date {
  color: #c4b8a0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.clock-time {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: #ffe7a3;
}

.tabs {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 72px;
  max-width: 200px;
  height: 30px;
  padding: 0 6px 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--mute);
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--tab);
  color: var(--well);
  border-color: var(--hair);
}

.tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 500;
}

.tab-close {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
}

.tab-close:hover,
.icon-btn:hover:not(:disabled) {
  background: #3a372f;
  color: var(--well);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.exitbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.nav {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--well);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.icon-btn:focus-visible,
.tab:focus-visible,
.tab-close:focus-visible,
.omnibox input:focus-visible,
.gate-card button:focus-visible,
.gate-card input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.icon-btn svg,
.scheme svg {
  width: 18px;
  height: 18px;
  display: block;
}

.omnibox {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 36px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  background: var(--well);
  color: var(--ink);
}

.scheme {
  display: grid;
  place-items: center;
  width: 22px;
  color: #6b6458;
}

.scheme.is-secure {
  color: #2f6b38;
}

.omnibox input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: -0.01em;
}

.omnibox input::placeholder {
  color: #8a8274;
  font-family: var(--sans);
}

.omnibox input:focus {
  outline: none;
}

.vpn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #5a4310;
  border-radius: 10px;
  background: #2a220e;
  color: var(--well);
}

.vpn-label {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}

.vpn select {
  flex: 1 1 auto;
  min-width: 0;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--well);
  font-family: inherit;
  font-size: 15px;
}

.vpn select:disabled {
  opacity: 0.55;
}

.vpn select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.exit {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  height: 36px;
  padding: 0 10px 0 9px;
  border: 1px solid #5a4310;
  border-radius: 999px;
  background: #2a220e;
  color: var(--amber);
}

.exit-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(124, 186, 90, 0.7);
}

.exit-dot.is-live {
  animation: pulse 1.8s ease-out infinite;
}

.exit-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.exit-ip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--well);
}

.kb-dock {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--hair);
  background: var(--chassis);
}

.kb-dock.is-armed .keysink {
  border-color: var(--amber);
}

.kb-label {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}

.keysink {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: var(--well);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
}

.keysink:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #0e0d0b;
  touch-action: none;
}

#view {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  cursor: default;
  touch-action: none;
  background: #0e0d0b;
}

#view:focus {
  outline: none;
}

.banner {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 8px;
  background: #2a220e;
  color: var(--well);
  font-size: 13px;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(227, 160, 8, 0.14), transparent 55%),
    var(--chassis);
}

.gate[hidden],
.banner[hidden] {
  display: none;
}

.gate-card {
  width: min(420px, 100%);
  padding: 32px 28px;
  border: 1px solid var(--hair);
  background: var(--panel);
}

.gate-mark {
  width: 28px;
  height: 28px;
  margin-bottom: 18px;
  border: 1.5px solid var(--amber);
  transform: rotate(45deg);
}

.gate-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
}

.gate-card h1 {
  margin: 0 0 10px;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.gate-copy {
  margin: 0 0 22px;
  color: var(--mute);
  line-height: 1.5;
}

.gate-card label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.gate-card input {
  width: 100%;
  height: 42px;
  margin-bottom: 14px;
  padding: 0 12px;
  border: 1px solid var(--hair);
  border-radius: 8px;
  background: #1a1916;
  color: var(--well);
}

.gate-card button {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--amber);
  color: #1a1916;
  font-weight: 600;
}

.gate-card button:hover {
  filter: brightness(1.05);
}

.gate-error {
  margin: -6px 0 12px;
  color: #f0b4aa;
  font-size: 13px;
}

.files-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  padding: 12px 12px 8px;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: #1c1a16;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.files-panel[hidden] {
  display: none;
}

.files-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.files-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.files-hint {
  margin: 6px 0 10px;
  color: var(--mute);
  font-size: 12px;
}

.files-list {
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.files-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--hair);
}

.files-list a {
  color: var(--well);
  text-decoration: none;
  font-size: 13px;
  word-break: break-word;
}

.files-list a:hover {
  color: var(--amber);
}

.files-meta {
  flex: 0 0 auto;
  color: var(--mute);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.files-empty {
  padding: 12px 0;
  color: var(--mute);
  font-size: 13px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(124, 186, 90, 0.55);
  }
  100% {
    box-shadow: 0 0 0 8px rgba(124, 186, 90, 0);
  }
}

@media (max-width: 720px) {
  .toolbar {
    flex-wrap: wrap;
  }

  .omnibox {
    order: 1;
    flex: 1 0 100%;
  }

  .exit {
    margin-left: auto;
  }

  .vpn {
    height: 44px;
  }

  .vpn select {
    font-size: 16px;
  }

  .exit-label {
    display: none;
  }

  .tab {
    max-width: 140px;
  }

  .clock {
    height: 36px;
    padding: 0 10px;
  }

  .clock-date {
    display: none;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .exit-dot.is-live {
    animation: none;
  }
}
