/* Lobby skin. Loaded after the inline sheet so equal-specificity rules win.
   Phone layout lives in the max-width block below. Do not set an unscoped
   tab direction that would erase the phone rail. Hero height stays 248 on
   desktop and 148 on a phone. Worlds stay 2 by 2 on a phone. */

#lobby {
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 700;
}
#lobby::after {
  background: linear-gradient(180deg, rgba(255,244,210,0.18), rgba(46,100,27,0.28));
}

.app-shell { max-width: 1168px; }
.app-titlebar {
  border: 3px solid var(--cream-300);
  border-bottom: none;
  box-shadow: none;
}
.app-body {
  color: var(--ink);
  background: var(--paper);
  background-blend-mode: multiply, normal;
  background-size: 160px 160px, auto;
  border: 3px solid var(--cream-300);
  border-top: none;
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,0.7),
    0 7px 0 var(--cream-400),
    0 18px 36px var(--warm-shadow);
  backdrop-filter: blur(var(--toolbar-glass-blur)) saturate(1.35);
  -webkit-backdrop-filter: blur(var(--toolbar-glass-blur)) saturate(1.35);
}
.tab-rail {
  width: 196px;
  padding: 14px 8px;
  background: transparent;
  border-right: none;
}
.tab-btn {
  flex-direction: row;
  justify-content: flex-start;
  gap: 12px;
  min-height: 58px;
  margin: 6px 8px;
  padding: 8px 12px;
  border-radius: 20px;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  background: transparent;
}
.tab-btn .tab-ico {
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 8px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, var(--cream-100));
  border: 3px solid var(--cream-300);
  box-shadow: 0 3px 0 var(--cream-400);
  box-sizing: border-box;
}
.tab-btn .tab-ico path { stroke: var(--ink-mute); stroke-width: 1.8; }
.tab-btn .tab-label { margin-top: 0; font-weight: 600; }
.tab-btn:hover { background: rgba(255,247,228,0.7); color: var(--ink); }
.tab-btn:hover .tab-ico path { stroke: var(--ink-soft); }
.tab-btn.active {
  background: linear-gradient(180deg, var(--sun-100), var(--sun-300));
  border: 3px solid var(--sun-700);
  color: var(--wood-900);
  box-shadow: inset 0 2px 0 #fff, 0 5px 0 var(--sun-800), 0 10px 14px var(--warm-shadow);
}
.tab-btn.active .tab-ico {
  background: radial-gradient(circle at 35% 30%, #fff 0 10%, var(--lily-300) 35%, var(--lily-500));
  border-color: var(--lily-700);
  box-shadow: 0 3px 0 var(--lily-800);
}
.tab-btn.active .tab-ico path { stroke: #fff; }
.tab-btn.active .tab-label { font-weight: 600; }

.pane-head h2,
.section-header,
.save-section-head,
.about-title,
.farm-card .nm,
.online-game-name {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
}
.pane-head h2 { font-size: 30px; }
.pane-head p,
.field-label,
.setting-note,
.lobby-empty,
.save-section-copy,
.about-lede,
.about-copy,
.farm-card .wld,
.farm-card .slot,
.farm-card .save-time,
.online-game-meta,
.slider-val,
.slider-note,
.lobby-table,
.lobby-table th,
.lobby-table td,
.slot-tile .slot-info,
.slot-tile .slot-num {
  color: var(--ink-soft);
  font-size: 16px;
}
.field-label,
.section-header,
.save-section-head { font-family: var(--font-display); font-size: 19px; color: var(--ink-soft); }
.lobby-empty,
.setting-note,
.save-section-copy,
.about-copy,
.about-lede { font-family: var(--font-ui); font-weight: 700; }
.about-kicker { color: var(--lily-800); font-size: 14px; letter-spacing: 0; text-transform: none; }
.about-title { font-size: 30px; }

#lobby input,
#lobby select,
#lobby textarea {
  color: var(--ink);
  background: linear-gradient(180deg, #fff3da, #fffcf3 40%);
  border: 3px solid var(--cream-300);
  border-radius: var(--radius-field);
  box-shadow: inset 0 4px 6px rgba(160,110,60,0.18);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 18px;
  caret-color: var(--pond-700);
  min-height: 54px;
}
#lobby input::placeholder { color: var(--ink-mute); }
#lobby input:hover,
#lobby select:hover,
#lobby textarea:hover,
#lobby input:focus,
#lobby select:focus,
#lobby textarea:focus {
  background: linear-gradient(180deg, #fff3da, #fffcf3 40%);
  border-color: var(--pond-500);
  box-shadow: inset 0 4px 6px rgba(160,110,60,0.16), 0 0 0 5px rgba(56,191,168,0.25);
}
#lobby input::selection { background: rgba(56,191,168,0.35); color: var(--ink); }
#lobby select { font-size: 16px; }

#createForm { align-content: start; }
.mode-toggle {
  max-width: none;
  padding: 6px;
  gap: 6px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, var(--cream-200), var(--cream-100));
  box-shadow: inset 0 3px 6px rgba(150,100,50,0.22);
}
#lobby .mode-btn {
  border: 3px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  box-shadow: none;
  text-shadow: none;
  min-height: 46px;
}
#lobby .mode-btn::before,
#lobby .mode-btn::after { display: none; }
#lobby .mode-btn:hover { background: rgba(255,255,255,0.45); color: var(--ink); }
#lobby .mode-btn.active,
#lobby .mode-btn.active:hover {
  background: linear-gradient(180deg, var(--lily-300) 0%, var(--lily-500) 52%, var(--lily-600) 100%);
  color: #fff;
  border-color: var(--lily-700);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.10), inset 0 2px 0 rgba(255,255,255,0.45), 0 4px 0 var(--lily-800);
  text-shadow: 0 2px 0 var(--lily-800);
}

#lobby .btn,
#lobby .lobby-btn {
  position: relative;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  border-radius: var(--radius-pill);
  border: 3px solid var(--cream-300);
  color: var(--ink-soft);
  background: linear-gradient(180deg, #fff 0%, var(--cream-50) 52%, var(--cream-100) 100%);
  box-shadow: inset 0 -4px 0 rgba(150,100,50,0.12), inset 0 2px 0 #fff, 0 4px 0 var(--cream-400), 0 8px 14px var(--warm-shadow);
  text-shadow: none;
}
#lobby .btn.small,
#lobby .lobby-btn.small { font-size: 14px; padding: 8px 14px; }
#lobby .btn.primary,
#lobby .lobby-btn.primary {
  font-size: 21px;
  color: #fff;
  border-color: var(--lily-700);
  background: linear-gradient(180deg, var(--lily-300) 0%, var(--lily-500) 52%, var(--lily-600) 100%);
  box-shadow: inset 0 -5px 0 rgba(0,0,0,0.10), inset 0 2px 0 rgba(255,255,255,0.45), 0 5px 0 var(--lily-800), 0 11px 18px var(--warm-shadow);
  text-shadow: 0 2px 0 var(--lily-800);
}
#lobby .btn.danger,
#lobby .lobby-btn.danger {
  color: #fff;
  border-color: var(--berry-700);
  background: linear-gradient(180deg, var(--berry-300), var(--berry-500) 52%, var(--berry-600));
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.10), 0 4px 0 var(--berry-800);
  text-shadow: 0 2px 0 var(--berry-800);
}
#lobby .btn.primary::before,
#lobby .lobby-btn.primary::before,
#lobby .btn.danger::before,
#lobby .lobby-btn.danger::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 4px;
  height: 42%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.08));
  pointer-events: none;
}
#lobby .btn:disabled,
#lobby .lobby-btn:disabled,
#lobby .btn.primary:disabled,
#lobby .btn.primary:disabled:hover {
  background: var(--cream-200);
  color: var(--ink-mute);
  border-color: var(--cream-300);
  box-shadow: none;
  text-shadow: none;
  transform: none;
}
.pane-actions { border-top: none; }

.picker-grid { gap: 12px; }
.picker-tile,
.slot-tile,
.farm-card,
.online-game-card {
  height: auto;
  overflow: visible;
  background: linear-gradient(180deg, #fff, var(--cream-50));
  border: 3px solid var(--cream-300);
  border-radius: 22px;
  box-shadow: 0 5px 0 var(--cream-400), 0 10px 16px rgba(96,52,18,0.16);
  color: var(--ink-soft);
}
.picker-tile {
  display: flex;
  flex-direction: column;
  width: auto;
  padding: 6px 6px 0;
}
.picker-tile .tile-img,
.char-tile canvas {
  width: 100%;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  background: radial-gradient(circle at 50% 40%, #fff, var(--lily-100));
}
.picker-tile .tile-name,
.char-tile .tile-name {
  position: static;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  text-align: center;
  padding: 6px 4px 8px;
}
.picker-tile.selected,
.slot-tile.selected {
  border-color: var(--lily-600);
  background: linear-gradient(180deg, var(--lily-50), #fff);
  transform: translateY(-3px);
  box-shadow: 0 0 0 4px rgba(108,191,60,0.28), 0 7px 0 var(--lily-700), 0 14px 20px rgba(96,52,18,0.22);
}
.picker-tile.selected .tile-name,
.slot-tile.selected .slot-num { color: var(--lily-800); }
.picker-tile.selected::after {
  content: "";
  position: absolute;
  top: -10px;
  right: -10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--lily-700);
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 12.5 L10 16.5 L18 8' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / 18px 18px no-repeat,
    radial-gradient(circle at 35% 30%, #fff 0 12%, var(--lily-300) 40%, var(--lily-500));
  box-shadow: 0 3px 0 var(--lily-800);
}
.char-tile.locked canvas,
.char-tile.locked .tile-img { filter: saturate(0.35) brightness(0.92); }
.char-tile .tile-lock {
  top: -8px;
  right: -8px;
  width: 32px;
  height: 32px;
  padding: 6px;
  border-radius: 50%;
  border: 2px solid var(--cream-400);
  background: linear-gradient(180deg, #fff, var(--cream-100));
  box-shadow: 0 2px 0 var(--cream-400);
}
.char-tile .tile-lock .lock-shackle,
.char-tile .tile-lock .lock-body { stroke: var(--ink-soft); fill: var(--cream-100); filter: none; }
.char-tile .tile-lock .lock-keyhole { fill: var(--ink-soft); }
.farm-card .thumb { background-color: var(--lily-100); color: var(--lily-800); }
.farm-card .body,
.online-game-card { color: var(--ink); }
.online-game-card { background: linear-gradient(180deg, #fff, var(--cream-50)); }
.online-game-code { color: var(--pond-800); }
.save-section + .save-section { border-top-color: var(--cream-300); }
.lobby-table th,
.lobby-table td { border-bottom-color: var(--cream-200); }
.lobby-table tr:hover td { background: rgba(255,226,122,0.25); }

.setting-switch span {
  background: linear-gradient(180deg, var(--cream-100), var(--cream-300));
  border: 3px solid var(--cream-400);
  box-shadow: inset 0 3px 5px rgba(150, 100, 50, 0.28), 0 3px 0 var(--cream-400);
}
.setting-switch span::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 4px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}
.setting-switch span::after {
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 35% 28%, #fff 0 18%, var(--cream-50) 46%, var(--cream-200));
  border: 2px solid var(--cream-400);
  box-shadow: inset 0 -2px 0 rgba(150, 100, 50, 0.22), inset 0 2px 0 #fff, 0 2px 0 var(--cream-400);
}
.setting-switch input:checked + span {
  background: linear-gradient(180deg, var(--lily-300) 0%, var(--lily-500) 55%, var(--lily-600));
  border-color: var(--lily-700);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12), inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 3px 0 var(--lily-800);
}
.setting-switch input:checked + span::after {
  background: radial-gradient(circle at 35% 28%, #fff 0 18%, var(--lily-100) 40%, #fff);
  border-color: var(--lily-700);
  box-shadow: inset 0 2px 0 #fff, 0 2px 0 var(--lily-800);
}
.setting-switch input:focus-visible + span { outline: 3px solid var(--pond-500); }

#lobby .slider-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  accent-color: auto;
}
#lobby .slider-row input[type="range"]:hover,
#lobby .slider-row input[type="range"]:focus {
  background: transparent;
  border: none;
  box-shadow: none;
}
#lobby .slider-row input[type="range"]:disabled { opacity: 0.55; }
#lobby .slider-row input[type="range"]::-webkit-slider-runnable-track {
  height: 16px;
  border-radius: 999px;
  border: 2px solid var(--cream-400);
  background:
    linear-gradient(180deg, var(--lily-300), var(--lily-500) 55%, var(--lily-600)) 0 0 / var(--range-fill, 0%) 100% no-repeat,
    linear-gradient(180deg, var(--cream-300), var(--cream-200));
  box-shadow: inset 0 3px 4px rgba(120, 70, 30, 0.3);
}
#lobby .slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -6px;
  border-radius: 50%;
  border: 3px solid var(--lily-700);
  background: radial-gradient(circle at 35% 28%, #fff 0 16%, var(--lily-100) 34%, var(--lily-500));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12), inset 0 2px 0 #fff, 0 3px 0 var(--lily-800);
}
#lobby .slider-row input[type="range"]::-moz-range-track {
  height: 16px;
  border: 2px solid var(--cream-400);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--cream-300), var(--cream-200));
  box-shadow: inset 0 3px 4px rgba(120, 70, 30, 0.3);
}
#lobby .slider-row input[type="range"]::-moz-range-progress {
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--lily-300), var(--lily-500) 55%, var(--lily-600));
}
#lobby .slider-row input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 3px solid var(--lily-700);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff 0 16%, var(--lily-100) 34%, var(--lily-500));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12), inset 0 2px 0 #fff, 0 3px 0 var(--lily-800);
}
.startup-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--cream-300);
  background: linear-gradient(180deg, #fff, var(--cream-100));
  color: var(--ink-soft);
  font-family: var(--font-display);
  box-shadow: 0 3px 0 var(--cream-400);
}
.startup-close:hover { background: #fff; border-color: var(--cream-400); color: var(--ink); }

@media (min-width: 721px) {
  #createForm {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    column-gap: 22px;
    align-items: end;
  }
  #createForm > .field-row:first-child { grid-column: 1; grid-row: 1; }
  #createNameRow { grid-column: 2; grid-row: 1; margin-bottom: 0; }
  #createSlotRow,
  #createForm > .field-row.top:nth-child(n+5) { grid-column: 1 / -1; }
  #cLevelPicker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
  }
  #cCharacterPicker,
  #jCharacterPicker {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
  }
  #cLevelPicker .picker-tile,
  #cCharacterPicker .picker-tile,
  #jCharacterPicker .picker-tile { width: auto; min-width: 0; }
}

@media (min-width: 721px) and (max-height: 860px) {
  .pane-head h2 { font-size: 28px; }
  .pane-head p { font-size: 14px; }
  .picker-tile .tile-img { height: 52px; }
  .char-tile canvas { height: 48px; }
  #lobby input,
  #lobby select,
  #lobby textarea { min-height: 42px; }
  .mode-btn { min-height: 40px; }
  .field-row { margin-bottom: 8px; }
}

@media (max-width: 720px) {
  .tab-rail {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 4px 4px;
    border-bottom: none;
  }
  .tab-btn {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 68px;
    margin: 2px;
    padding: 4px 2px 6px;
    border: none;
    box-shadow: none;
    background: transparent;
    font-size: 14px;
  }
  .tab-btn .tab-ico { width: 36px; height: 36px; padding: 7px; }
  .tab-btn .tab-label { margin-top: 2px; font-size: 14px; text-align: center; }
  .tab-btn.active {
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--ink);
  }
  .pane-head h2 { font-size: 24px; }
  .pane-head p { font-size: 14px; }
  #cLevelPicker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
  }
  #cCharacterPicker,
  #jCharacterPicker {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
  }
  #cCharacterPicker .char-tile,
  #jCharacterPicker .char-tile { width: 112px; flex: 0 0 112px; }
  .picker-tile .tile-img { height: 64px; }
  .char-tile canvas { height: 64px; }
  #lobby .btn,
  #lobby .lobby-btn { font-size: 16px; }
  #lobby .btn.primary,
  #lobby .lobby-btn.primary { font-size: 18px; }
}

@media (max-width: 380px) {
  .tab-btn { font-size: 14px; min-height: 64px; }
  .tab-btn .tab-label { font-size: 14px; }
  .pane-head p { font-size: 14px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .tab-btn { flex-direction: column; font-size: 14px; }
  .pane-head h2 { font-size: 20px; }
  .pane-head p { font-size: 14px; }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  #lobby .btn.primary,
  #lobby .lobby-btn.primary,
  #lobby .btn.danger,
  #lobby .lobby-btn.danger {
    transition: transform 140ms ease-out;
  }
  #lobby .btn.primary:hover,
  #lobby .lobby-btn.primary:hover {
    transform: translateY(-2px) scale(1.04);
    animation: bubbly-wobble 600ms ease-out 1;
  }
  #lobby .btn.primary:active,
  #lobby .lobby-btn.primary:active,
  #lobby .btn.danger:active,
  #lobby .lobby-btn.danger:active {
    transform: translateY(4px) scale(0.96, 0.94);
    transition-duration: 70ms;
  }
  .picker-tile { transition: transform 200ms ease-out, box-shadow 200ms ease-out; }
}
@media (prefers-reduced-motion: reduce) {
  #lobby .btn,
  #lobby .btn:hover,
  #lobby .btn:active,
  #lobby .lobby-btn,
  #lobby .lobby-btn:hover,
  #lobby .lobby-btn:active,
  .picker-tile,
  .picker-tile.selected,
  .tab-btn {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}
