:root {
  --theme-bg: #07111f;
  --theme-bg-deep: #030812;
  --theme-panel: rgba(11, 27, 46, 0.96);
  --theme-panel-soft: rgba(17, 38, 62, 0.84);
  --theme-panel-hover: rgba(25, 52, 81, 0.94);
  --theme-border: rgba(151, 188, 218, 0.18);
  --theme-border-strong: rgba(255, 195, 44, 0.58);
  --theme-gold: #ffc32c;
  --theme-gold-light: #ffe48a;
  --theme-orange: #f28c18;
  --theme-cyan: #69d2df;
  --theme-text: #f4f8fc;
  --theme-muted: #9bacc0;
  --theme-danger: #ff7f73;
  --theme-success: #74dfab;
  --theme-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
  color-scheme: dark;
}

* {
  scrollbar-color: rgba(255, 195, 44, 0.46) rgba(6, 16, 29, 0.64);
}

body {
  color: var(--theme-text);
  background:
    radial-gradient(circle at 50% -10%, rgba(44, 113, 153, 0.35), transparent 38%),
    linear-gradient(150deg, var(--theme-bg) 0%, var(--theme-bg-deep) 100%);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

#game {
  background: #0b1728;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(105, 210, 223, 0.72);
  outline-offset: 3px;
}

/* Persistent game controls */
#settings-btn {
  top: 18px;
  right: 18px;
  width: auto;
  min-width: 112px;
  height: 44px;
  padding: 0 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--theme-text);
  border: 1px solid rgba(255, 195, 44, 0.42);
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(17, 37, 60, 0.96), rgba(6, 17, 31, 0.96));
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.28), inset 3px 0 0 var(--theme-gold);
  backdrop-filter: blur(12px);
  transform: none;
}

#settings-btn:hover:not(:disabled) {
  color: var(--theme-gold-light);
  border-color: var(--theme-gold);
  background: linear-gradient(145deg, rgba(26, 51, 79, 0.98), rgba(9, 23, 40, 0.98));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36), inset 3px 0 0 var(--theme-gold);
  transform: translateY(-2px);
}

#settings-btn:active:not(:disabled) {
  transform: translateY(0);
}

#settings-btn:disabled {
  opacity: 0;
  pointer-events: none;
}

.menu-trigger-icon {
  width: 18px;
  display: grid;
  gap: 4px;
}

.menu-trigger-icon i {
  width: 100%;
  height: 2px;
  display: block;
  border-radius: 4px;
  background: var(--theme-gold);
  box-shadow: 0 0 10px rgba(255, 195, 44, 0.25);
}

.menu-trigger-icon i:nth-child(2) {
  width: 72%;
}

.menu-trigger-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.hint {
  bottom: 17px;
  margin: 0;
  padding: 9px 14px;
  color: rgba(233, 242, 250, 0.8);
  font-size: 12px;
  letter-spacing: 0.025em;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 9px;
  background: rgba(4, 12, 23, 0.66);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(9px);
}

kbd {
  color: var(--theme-gold-light);
  border: 1px solid rgba(255, 195, 44, 0.32);
  border-bottom-color: rgba(255, 195, 44, 0.7);
  background: rgba(255, 195, 44, 0.08);
  box-shadow: none;
}

/* Entry gate */
.entry {
  display: flex;
  padding: clamp(20px, 5vw, 64px);
  align-items: center;
  justify-content: flex-start;
  overflow: auto;
  color: var(--theme-text);
  background:
    radial-gradient(circle at 16% 26%, rgba(38, 137, 169, 0.25), transparent 30%),
    radial-gradient(circle at 83% 70%, rgba(242, 140, 24, 0.13), transparent 34%),
    linear-gradient(120deg, rgba(3, 10, 20, 0.78), rgba(5, 16, 29, 0.94));
}

.entry::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.23;
  background-image:
    linear-gradient(rgba(111, 176, 211, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111, 176, 211, 0.16) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at 20% 50%, black, transparent 64%);
}

.entry-panel {
  position: relative;
  width: min(430px, 100%);
  margin-left: clamp(0px, 8vw, 120px);
  padding: clamp(27px, 4.4vw, 48px);
  overflow: hidden;
  color: var(--theme-text);
  border: 1px solid var(--theme-border);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(17, 38, 62, 0.97), rgba(7, 19, 34, 0.98));
  box-shadow: var(--theme-shadow), inset 4px 0 0 var(--theme-gold);
  backdrop-filter: blur(22px);
}

.entry-panel::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 145px;
  height: 145px;
  content: "";
  opacity: 0.4;
  background: linear-gradient(135deg, transparent 49.5%, rgba(255, 195, 44, 0.22) 50%, transparent 51%);
  transform: translate(36px, -36px);
}

.entry-brand {
  margin-bottom: 23px;
  color: var(--theme-gold-light);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
}

.entry-brand img {
  width: 40px;
  height: 40px;
  padding: 7px;
  border: 1px solid rgba(255, 195, 44, 0.42);
  border-radius: 10px;
  background: rgba(255, 195, 44, 0.09);
  filter: drop-shadow(0 7px 12px rgba(0, 0, 0, 0.3));
}

.entry h1 {
  max-width: 380px;
  margin: 0 0 12px;
  color: var(--theme-text);
  font-family: "Arial Narrow", "Bahnschrift Condensed", "Segoe UI", sans-serif;
  font-size: clamp(38px, 5vw, 58px);
  font-stretch: condensed;
  line-height: 0.96;
  letter-spacing: -0.035em;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
}

.entry-copy,
.entry-note {
  color: var(--theme-muted);
}

.entry-copy {
  margin-bottom: 28px;
  line-height: 1.65;
}

.entry-form label {
  color: #cbd7e3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.entry-form input,
.friend-add input,
#net-name,
#net-roomname,
#net-pass,
#net-join-id,
#net-join-pass,
.room-password,
.auth-input {
  color: var(--theme-text) !important;
  border: 1px solid rgba(151, 188, 218, 0.24) !important;
  border-radius: 9px !important;
  background: rgba(3, 12, 23, 0.7) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035) !important;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.entry-form input {
  min-height: 48px;
}

.entry-form input::placeholder,
.friend-add input::placeholder,
#net-name::placeholder,
#net-roomname::placeholder,
#net-pass::placeholder,
#net-join-id::placeholder,
#net-join-pass::placeholder,
.room-password::placeholder,
.auth-input::placeholder {
  color: #667b90;
}

.entry-form input:focus,
.friend-add input:focus,
#net-name:focus,
#net-roomname:focus,
#net-pass:focus,
#net-join-id:focus,
#net-join-pass:focus,
.room-password:focus,
.auth-input:focus {
  border-color: rgba(105, 210, 223, 0.82) !important;
  background: rgba(5, 18, 33, 0.92) !important;
  box-shadow: 0 0 0 4px rgba(105, 210, 223, 0.1) !important;
}

.entry-actions {
  gap: 10px;
}

.entry-divider {
  color: #6e8195;
}

.entry-divider::before,
.entry-divider::after {
  background: rgba(151, 188, 218, 0.16);
}

.entry-divider span {
  padding: 0 12px;
  background: transparent;
}

.entry-error,
.net-error {
  color: var(--theme-danger);
}

/* Shared full-screen surfaces */
.settings {
  padding: 0;
  color: var(--theme-text);
  background:
    radial-gradient(circle at 86% 12%, rgba(35, 105, 142, 0.23), transparent 30%),
    radial-gradient(circle at 12% 92%, rgba(242, 140, 24, 0.1), transparent 31%),
    rgba(3, 9, 18, 0.93);
  backdrop-filter: blur(15px);
}

.settings::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.13;
  background-image:
    linear-gradient(rgba(151, 188, 218, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(151, 188, 218, 0.15) 1px, transparent 1px);
  background-size: 48px 48px;
}

.settings-panel {
  color: var(--theme-text);
  border: 0;
  border-radius: 0;
  background: rgba(6, 17, 31, 0.82);
  box-shadow: none;
}

.settings-head {
  min-height: 78px;
  padding: 16px clamp(20px, 5vw, 72px);
  color: var(--theme-text);
  border-bottom: 1px solid var(--theme-border);
  background: rgba(7, 18, 32, 0.9);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(18px);
}

.settings-head::before {
  width: 5px;
  height: 28px;
  margin-right: 13px;
  content: "";
  border-radius: 2px;
  background: linear-gradient(var(--theme-gold), var(--theme-orange));
  box-shadow: 0 0 20px rgba(255, 195, 44, 0.24);
}

.settings-head h2 {
  margin: 0;
  color: var(--theme-text);
  font-family: "Arial Narrow", "Bahnschrift Condensed", "Segoe UI", sans-serif;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.panel-close {
  width: 42px;
  height: 42px;
  color: #cbd7e3;
  font-size: 27px;
  border: 1px solid var(--theme-border);
  border-radius: 9px;
  background: rgba(16, 34, 55, 0.72);
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.panel-close:hover {
  color: var(--theme-gold-light);
  border-color: rgba(255, 195, 44, 0.52);
  background: rgba(255, 195, 44, 0.09);
  transform: rotate(4deg);
}

.settings-tabs {
  gap: 8px;
  padding: 12px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--theme-border);
  background: rgba(8, 21, 37, 0.82);
}

.tab {
  flex: 0 1 190px;
  min-height: 40px;
  padding: 9px 16px;
  color: var(--theme-muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.055em;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
}

.tab:hover {
  color: var(--theme-text);
  border-color: var(--theme-border);
  background: rgba(255, 255, 255, 0.035);
}

.tab.active {
  color: #291900;
  border-color: var(--theme-gold);
  background: linear-gradient(135deg, var(--theme-gold-light), var(--theme-gold));
  box-shadow: 0 7px 18px rgba(255, 166, 20, 0.17);
}

.settings-body,
.pause-body {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: clamp(26px, 5vw, 64px) clamp(20px, 5vw, 72px);
  color: var(--theme-text);
}

.settings-body h3,
.inventory-body h3,
.net-home h3 {
  color: var(--theme-text);
  font-family: "Arial Narrow", "Bahnschrift Condensed", "Segoe UI", sans-serif;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.settings-body p,
.pause-body p {
  color: var(--theme-muted);
}

.settings-foot {
  min-height: 68px;
  padding: 12px clamp(20px, 5vw, 72px);
  color: var(--theme-muted);
  border-top: 1px solid var(--theme-border);
  background: rgba(7, 18, 32, 0.9);
}

#settings-reset {
  padding: 9px 14px;
  color: #d7e2ec;
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  background: rgba(21, 43, 67, 0.72);
}

#settings-reset:hover {
  color: var(--theme-gold-light);
  border-color: rgba(255, 195, 44, 0.44);
}

/* Buttons and cards */
.menu-btn {
  min-height: 48px;
  color: #e7eef5;
  border: 1px solid var(--theme-border);
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(25, 49, 76, 0.92), rgba(12, 29, 49, 0.92));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  transition: transform 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.menu-btn:hover:not(:disabled) {
  color: var(--theme-text);
  border-color: rgba(105, 210, 223, 0.46);
  background: linear-gradient(145deg, rgba(31, 61, 92, 0.96), rgba(14, 35, 59, 0.96));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}

.menu-btn:active:not(:disabled) {
  transform: translateY(0);
}

.menu-btn.small {
  min-height: 38px;
}

.menu-btn.primary,
#friend-add-btn,
#net-create {
  color: #291900;
  border-color: var(--theme-gold);
  background: linear-gradient(135deg, var(--theme-gold-light), var(--theme-gold) 60%, var(--theme-orange));
  box-shadow: 0 10px 26px rgba(242, 140, 24, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.menu-btn.primary:hover:not(:disabled),
#friend-add-btn:hover:not(:disabled),
#net-create:hover:not(:disabled) {
  color: #1e1300;
  border-color: var(--theme-gold-light);
  background: linear-gradient(135deg, #fff1aa, #ffd147 58%, #f59b25);
}

.menu-btn.guest {
  color: #dbe7f0;
  border-color: rgba(151, 188, 218, 0.22);
  background: rgba(11, 27, 46, 0.68);
}

.menu-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.option,
.sound-row,
.friends-card,
.friend-row,
.rooms-create,
.room-row,
.room-current {
  color: var(--theme-text);
  border-color: var(--theme-border);
  background: linear-gradient(145deg, rgba(19, 42, 67, 0.88), rgba(9, 24, 42, 0.88));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.option:hover,
.sound-row:hover,
.friend-row:hover,
.room-row:hover {
  border-color: rgba(105, 210, 223, 0.38);
  background: linear-gradient(145deg, rgba(26, 53, 82, 0.94), rgba(12, 31, 52, 0.94));
}

.option.selected {
  color: var(--theme-text);
  border-color: var(--theme-gold);
  background: linear-gradient(145deg, rgba(255, 195, 44, 0.15), rgba(19, 42, 67, 0.92));
  box-shadow: 0 0 0 1px rgba(255, 195, 44, 0.16), 0 14px 30px rgba(0, 0, 0, 0.2);
}

.option.locked {
  opacity: 0.52;
}

.option canvas {
  border: 1px solid rgba(151, 188, 218, 0.14);
  border-radius: 8px;
  background: radial-gradient(circle, rgba(105, 210, 223, 0.11), rgba(3, 12, 23, 0.48));
}

.sound-row strong,
.option .name,
.sound-row-head,
.up-account,
.friend-info strong {
  color: var(--theme-text);
}

.option small,
.option .sub,
.sound-row small,
.sound-note,
.friend-info span,
.friend-empty,
.rooms-note {
  color: var(--theme-muted);
}

.option.selected .name,
.option.selected .sub,
.sound-sub,
.sound-val,
.pips,
.up-bal,
.net-ping,
.room-ping {
  color: var(--theme-gold-light);
}

.sound-row input[type="range"] {
  accent-color: var(--theme-gold);
}

/* Main menu */
#pause .settings-panel {
  background:
    radial-gradient(circle at 50% 48%, rgba(24, 65, 96, 0.24), transparent 42%),
    rgba(5, 15, 28, 0.88);
}

#pause-main {
  max-width: 720px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: center;
}

#pause-main .room-current,
#pause-main #resume-btn,
#pause-main #rooms-btn {
  grid-column: 1 / -1;
}

#pause-main .room-current {
  min-height: 42px;
  margin: 0 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--theme-cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#pause-main .menu-btn {
  min-height: 58px;
  font-size: 14px;
  letter-spacing: 0.025em;
}

#pause-main #resume-btn {
  min-height: 64px;
  font-size: 16px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Inventory */
.gold-icon {
  filter: drop-shadow(0 4px 8px rgba(255, 166, 20, 0.22));
}

.up-account {
  padding: 12px 14px;
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  background: rgba(5, 17, 31, 0.52);
}

/* Friends */
.friends-body {
  max-width: 860px;
}

.friend-count {
  color: var(--theme-gold-light);
  border-color: rgba(255, 195, 44, 0.28);
  background: rgba(255, 195, 44, 0.09);
}

.friend-add {
  padding: 14px;
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  background: rgba(5, 17, 31, 0.52);
}

.friend-avatar {
  color: var(--theme-gold-light);
  border: 1px solid rgba(255, 195, 44, 0.25);
  background: linear-gradient(145deg, rgba(255, 195, 44, 0.16), rgba(14, 35, 58, 0.9));
}

.friend-info .friend-online {
  color: var(--theme-success);
}

.friend-info .friend-offline {
  color: #718397;
}

.friend-row.invite-row {
  border-color: rgba(255, 195, 44, 0.38);
  background: linear-gradient(145deg, rgba(255, 195, 44, 0.11), rgba(10, 28, 47, 0.9));
}

.menu-btn.danger {
  color: #ffaaa2;
  border-color: rgba(255, 127, 115, 0.3);
  background: rgba(255, 127, 115, 0.07);
}

.menu-btn.danger:hover:not(:disabled) {
  color: #ffd0cc;
  border-color: rgba(255, 127, 115, 0.6);
  background: rgba(255, 127, 115, 0.13);
}

.friend-empty {
  border-color: var(--theme-border);
  background: rgba(7, 20, 36, 0.56);
}

/* Multiplayer rooms */
#net-home,
#net-lobby {
  width: min(760px, 100%);
  margin: 0 auto;
  color: var(--theme-text);
}

#net-home {
  padding: clamp(24px, 4vw, 52px) clamp(20px, 5vw, 72px);
}

.rooms-create {
  padding: 14px;
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  background: rgba(5, 17, 31, 0.52);
}

.rooms-create input {
  min-height: 44px;
}

.room-row {
  border-radius: 10px;
}

.room-row.active {
  color: var(--theme-gold-light);
  border-color: var(--theme-gold);
  background: linear-gradient(145deg, rgba(255, 195, 44, 0.14), rgba(11, 31, 51, 0.92));
}

.room-password {
  width: 90px;
  padding: 7px 8px;
  font-size: 13px;
}

.auth-input {
  width: 100%;
  padding: 9px 10px;
  font-size: 14px;
}

.rooms-note {
  line-height: 1.55;
}

/* Responsive */
@media (max-width: 720px) {
  #settings-btn {
    top: 12px;
    right: 12px;
    min-width: 98px;
    height: 40px;
    padding: 0 13px;
  }

  .entry {
    padding: 16px;
    align-items: center;
  }

  .entry-panel {
    margin: 0;
    padding: 28px 23px;
    border-radius: 15px;
  }

  .entry h1 {
    font-size: clamp(36px, 12vw, 50px);
  }

  .settings-head {
    min-height: 64px;
    padding: 11px 16px;
  }

  .settings-head h2 {
    font-size: 24px;
  }

  .settings-tabs {
    padding: 9px 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tab {
    width: 100%;
    padding: 8px 6px;
  }

  .settings-body,
  .pause-body,
  #net-home {
    padding: 22px 16px;
  }

  .settings-foot {
    padding: 10px 16px;
  }

  #pause-main {
    grid-template-columns: 1fr;
    align-content: start;
  }

  #pause-main .room-current,
  #pause-main #resume-btn,
  #pause-main #rooms-btn {
    grid-column: auto;
  }

  #pause-main .menu-btn,
  #pause-main #resume-btn {
    min-height: 50px;
  }

  .hint {
    display: none;
  }

  .option {
    min-width: 0;
  }

}

@media (max-width: 520px) {
  .entry-actions,
  .friend-add,
  .rooms-create {
    grid-template-columns: 1fr;
  }

  .friend-add,
  .rooms-create {
    display: grid;
  }

  .friend-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .friend-actions .menu-btn {
    flex: 1;
  }

  .room-row {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
