.game-main {
  display: grid;
  gap: 1.15rem;
}

.playable-section {
  padding: clamp(0.9rem, 2vw, 1.3rem);
}

.game-table-wrap {
  display: grid;
  gap: 1rem;
  background:
    radial-gradient(circle at 16% 10%, rgba(255, 255, 255, 0.24), transparent 38%),
    radial-gradient(circle at 90% 84%, rgba(255, 255, 255, 0.13), transparent 35%),
    var(--table-bg, radial-gradient(circle at 18% 12%, #35a681, #137454 58%, #0b5039 100%));
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), 0 20px 46px rgba(10, 48, 36, 0.34);
  padding: clamp(0.9rem, 2vw, 1.3rem);
}

.game-top-panel {
  display: grid;
  gap: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(8, 48, 36, 0.62), rgba(16, 65, 49, 0.52));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  padding: 0.75rem;
}

.game-toolbar {
  display: grid;
  gap: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 0.72rem;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.46rem;
}

.toolbar-actions .btn {
  padding: 0.52rem 0.84rem;
  border-radius: 11px;
  font-size: 0.84rem;
  border-width: 1px;
}

.toolbar-actions .btn--ghost {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(17, 59, 44, 0.2);
}

.toolbar-actions .btn--soft {
  background: rgba(201, 234, 222, 0.94);
  border-color: rgba(13, 80, 57, 0.2);
}

.in-game-hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
}

.game-stats {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.game-stats--embedded {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.game-stat {
  min-width: 0;
  border: 1px solid rgba(10, 53, 39, 0.14);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(246, 255, 251, 0.8), rgba(215, 238, 229, 0.8));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.44);
  padding: 0.46rem 0.58rem;
  display: grid;
  gap: 0.08rem;
}

.game-stat span {
  font-size: 0.74rem;
  color: rgba(15, 40, 32, 0.82);
}

.game-stat strong {
  font-family: var(--font-display);
  letter-spacing: 0.01em;
  font-size: 1.13rem;
  color: #0f1f1a;
}

body.game-booting .game-stat strong[data-mode] {
  opacity: 0;
}

.sound-toggle-btn {
  min-width: 126px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(8, 35, 26, 0.7);
  color: #effbf6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.36rem;
  padding: 0 0.7rem;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 760;
  letter-spacing: 0.01em;
  transition: transform var(--transition), background-color var(--transition), border-color var(--transition), color var(--transition);
  touch-action: manipulation;
}

.sound-toggle-btn__icon {
  font-size: 1.08rem;
  line-height: 1;
}

.sound-toggle-btn:hover,
.sound-toggle-btn:focus-visible {
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.18);
}

.sound-toggle-btn:active {
  transform: scale(0.96);
}

.sound-toggle-btn.is-muted {
  background: rgba(52, 16, 16, 0.66);
  border-color: rgba(255, 176, 176, 0.62);
  color: #ffdede;
}

.game-table {
  --card-w: clamp(64px, 12.42vw, 120px);
  --card-h: calc(var(--card-w) * 1.4);
  --tableau-down-gap: clamp(10px, 1.8vw, 17px);
  --tableau-up-gap: clamp(18px, 3.4vw, 30px);
  --deal-anim: 220ms;

  min-height: min(78vh, 860px);
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 1.08rem;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y pinch-zoom;
}

.game-table,
.game-table * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body[data-animation-speed="slow"] .game-table {
  --deal-anim: 340ms;
}

body[data-animation-speed="fast"] .game-table {
  --deal-anim: 120ms;
}

.top-piles {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

.stock-waste,
.foundations {
  display: flex;
  gap: 0.65rem;
}

body.left-handed .top-piles {
  flex-direction: row-reverse;
}

.tableau-piles {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(0.3rem, 1.2vw, 0.72rem);
  align-items: start;
}

.pile {
  width: var(--card-w);
  min-height: var(--card-h);
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.42);
  position: relative;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.pile--tableau {
  width: 100%;
  min-height: max(calc(var(--card-h) + 176px), 300px);
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.23);
  background: rgba(0, 0, 0, 0.11);
}

.pile.is-highlight {
  border-color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.14);
}

.pile.is-selected {
  border-color: rgba(255, 255, 255, 0.72);
}

.pile.is-hint {
  box-shadow: 0 0 0 2px rgba(255, 214, 10, 0.88), inset 0 0 0 1px rgba(255, 214, 10, 0.56);
}

.playing-card {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 11px;
  border: 1px solid rgba(20, 32, 30, 0.2);
  position: absolute;
  left: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.24rem 0.28rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 60%, #eff3f6 100%);
  color: #132026;
  box-shadow: var(--shadow-card);
  cursor: grab;
  transform: translate3d(0, 0, 0);
  transition:
    top var(--deal-anim),
    left var(--deal-anim),
    transform var(--deal-anim),
    box-shadow var(--deal-anim),
    opacity var(--deal-anim);
  touch-action: none;
  -webkit-user-drag: none;
}

.playing-card * {
  pointer-events: none;
  -webkit-user-drag: none;
}

.playing-card:active {
  cursor: grabbing;
}

.playing-card--face-down {
  border-color: rgba(255, 255, 255, 0.62);
  background: linear-gradient(145deg, #1a5777, #123e56);
  overflow: hidden;
}

body[data-deck-back="classic"] .playing-card--face-down::before,
body[data-deck-back="linen"] .playing-card--face-down::before,
body[data-deck-back="sunburst"] .playing-card--face-down::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

body[data-deck-back="classic"] .playing-card--face-down::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 7px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%) 0 0 / 11px 11px,
    linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%) 0 0 / 11px 11px,
    rgba(13, 78, 110, 0.76);
}

body[data-deck-back="linen"] .playing-card--face-down {
  background: linear-gradient(145deg, #aa2f34, #6d181d);
}

body[data-deck-back="linen"] .playing-card--face-down::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 7px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.2), transparent 28%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0 2px, transparent 2px 4px),
    rgba(133, 26, 31, 0.82);
}

body[data-deck-back="sunburst"] .playing-card--face-down {
  background: linear-gradient(145deg, #285d38, #173a22);
}

body[data-deck-back="sunburst"] .playing-card--face-down::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 7px;
  background:
    conic-gradient(
      from 0deg,
      rgba(255, 255, 255, 0.3),
      rgba(255, 255, 255, 0.04),
      rgba(255, 255, 255, 0.22),
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.3)
    ),
    rgba(26, 78, 44, 0.82);
}

.playing-card--red {
  color: #cb2d2d;
}

.playing-card--black {
  color: #101a27;
}

.playing-card__corner {
  line-height: 1;
  display: grid;
  gap: 0.08rem;
}

.playing-card__corner--bottom {
  transform: rotate(180deg);
  align-self: flex-end;
}

.playing-card__rank {
  font-weight: 830;
  font-size: clamp(0.9rem, 1.9vw, 1.05rem);
}

.playing-card__suit {
  font-size: clamp(0.76rem, 1.6vw, 0.9rem);
}

.playing-card__center {
  display: grid;
  place-items: center;
  font-size: clamp(1.5rem, 3.6vw, 2.08rem);
  font-weight: 760;
}

body[data-card-face="minimal"] .playing-card {
  background: #ffffff;
}

body[data-card-face="minimal"] .playing-card__center {
  font-size: clamp(1.24rem, 2.8vw, 1.7rem);
}

body[data-card-face="vintage"] .playing-card {
  background: linear-gradient(180deg, #fbf6ed, #f3e8d6 82%);
}

body[data-card-face="vintage"] .playing-card__center {
  font-family: "Georgia", serif;
}

.card-placeholder {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.5);
}

/* In top piles the pile itself already has a dashed frame, so avoid double outline. */
.top-piles .card-placeholder {
  border: 0;
}

.drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  pointer-events: none;
}

.drag-ghost .playing-card {
  position: absolute;
}

.playing-card.is-drag-origin {
  opacity: 0.24;
}

.playing-card.is-selected {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.92), var(--shadow-card);
}

.playing-card.is-hint {
  box-shadow: 0 0 0 2px rgba(255, 214, 10, 0.92), var(--shadow-card);
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(10, 18, 24, 0.56);
  backdrop-filter: blur(8px);
}

.modal-layer.is-open {
  display: flex;
}

.modal {
  width: min(680px, 94vw);
  max-height: 90vh;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-strong);
  box-shadow: var(--shadow-hard);
  padding: 1.1rem;
}

.modal--settings {
  width: min(980px, 96vw);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.modal__title {
  font-size: 1.2rem;
}

.modal__close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}

.settings-form {
  display: grid;
  gap: 0.95rem;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 0.88rem;
  align-items: start;
}

.settings-panel {
  border: 1px solid rgba(13, 62, 46, 0.16);
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.72), rgba(238, 246, 242, 0.8));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  padding: 0.84rem;
}

.settings-panel__head {
  display: grid;
  gap: 0.14rem;
  margin-bottom: 0.62rem;
}

.settings-panel__head h3 {
  font-size: 1rem;
}

.settings-panel__head p {
  margin: 0;
  font-size: 0.81rem;
  color: rgba(17, 44, 36, 0.72);
}

.settings-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.62rem;
}

.settings-item {
  display: grid;
  gap: 0.34rem;
  align-content: start;
}

.settings-item--full {
  grid-column: 1 / -1;
}

.settings-item label {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(14, 34, 29, 0.88);
}

.modal--settings select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(11, 58, 43, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-primary);
  padding: 0.56rem 0.78rem;
  font-size: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.modal--settings select:focus-visible,
.modal--settings input[type="range"]:focus-visible {
  outline: 2px solid rgba(12, 157, 110, 0.35);
  outline-offset: 1px;
}

.settings-switches {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.58rem;
  font-size: 0.95rem;
}

.toggle--card {
  border: 1px solid rgba(11, 58, 43, 0.17);
  border-radius: 12px;
  padding: 0.52rem 0.6rem;
  background: rgba(255, 255, 255, 0.62);
  font-weight: 680;
}

.toggle input {
  width: 19px;
  height: 19px;
  accent-color: #0ea376;
}

.volume-control {
  display: grid;
  gap: 0.32rem;
}

.settings-audio {
  display: grid;
  gap: 0.62rem;
  padding-top: 0.58rem;
  border-top: 1px solid rgba(11, 58, 43, 0.16);
}

.settings-audio.is-disabled {
  opacity: 0.5;
}

.volume-control label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(13, 35, 30, 0.88);
}

.volume-control input[type="range"] {
  width: 100%;
  accent-color: #0ea376;
}

.modal__actions--settings {
  border-top: 1px solid rgba(15, 63, 47, 0.16);
  padding-top: 0.82rem;
  margin-top: 0.1rem;
}

.modal__actions {
  margin-top: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.stats-panel .card {
  padding: 0.68rem;
}

.stats-panel strong {
  display: block;
  font-size: 1.03rem;
}

.hint-toast {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  z-index: 130;
  color: #fff;
  background: rgba(6, 14, 20, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  padding: 0.56rem 0.82rem;
  font-size: 0.86rem;
  transition: opacity 140ms ease, transform 140ms ease;
}

.hint-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.game-mobile-actions {
  display: none;
}

@keyframes pop {
  0% {
    transform: scale(0.94);
    opacity: 0.5;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.pile .playing-card:last-child {
  animation: pop 150ms ease;
}

body.reduce-motion .pile .playing-card:last-child {
  animation: none;
}

body.reduce-motion .playing-card {
  transition-duration: 70ms;
}

body.reduce-motion .hint-toast,
body.reduce-motion .sound-toggle-btn,
body.reduce-motion .modal-layer,
body.reduce-motion .modal {
  transition-duration: 70ms;
}

@media (max-width: 1120px) {
  .toolbar-actions {
    gap: 0.4rem;
  }

  .toolbar-actions .btn {
    font-size: 0.8rem;
  }
}

@media (max-width: 940px) {
  .game-toolbar {
    display: none;
  }

  .game-top-panel {
    padding: 0.62rem;
    gap: 0.5rem;
  }

  .in-game-hud {
    gap: 0.45rem;
  }

  .game-table {
    --card-w: clamp(58px, 14.26vw, 97px);
    min-height: min(74vh, 760px);
  }

  .game-mobile-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    position: static;
    z-index: 56;
    gap: 0.42rem;
    margin-top: 0.54rem;
    border-radius: 14px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-strong);
    backdrop-filter: var(--surface-blur);
  }

  .game-mobile-actions .btn {
    min-width: 0;
    padding: 0.5rem 0.62rem;
    font-size: 0.82rem;
    width: 100%;
  }

  .modal--settings {
    width: min(760px, 96vw);
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .modal--settings {
    width: min(96vw, 620px);
    padding: 0.92rem;
  }

  .settings-panel {
    padding: 0.72rem;
  }

  .settings-fields {
    grid-template-columns: 1fr;
  }

  .toggle--card {
    font-size: 0.9rem;
  }

  .modal__actions--settings .btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
  }

  .playable-section {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .playable-section::before {
    display: none;
  }
}

@media (max-width: 660px) {
  .game-table-wrap {
    padding: 0.46rem;
    gap: 0.54rem;
    border-radius: 16px;
  }

  .game-top-panel {
    padding: 0.46rem;
    border-radius: 11px;
  }

  .game-table {
    --card-w: clamp(46px, 13.57vw, 58px);
    --tableau-down-gap: 6px;
    --tableau-up-gap: 12px;
    gap: 0.52rem;
    min-height: auto;
  }

  .tableau-piles {
    gap: 0.2rem;
  }

  .pile--tableau {
    min-height: max(calc(var(--card-h) + 98px), 205px);
  }

  .top-piles {
    gap: 0.22rem;
  }

  .stock-waste,
  .foundations {
    gap: 0.2rem;
  }

  .game-stats--embedded {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.34rem;
  }

  .game-stat {
    padding: 0.38rem 0.48rem;
  }

  .game-stat strong {
    font-size: 1rem;
  }

  .playing-card {
    padding: 0.16rem 0.18rem;
    border-radius: 9px;
    overflow: hidden;
    display: block;
  }

  .playing-card__corner {
    position: absolute;
    left: 4px;
    top: 3px;
    gap: 0;
    line-height: 0.95;
  }

  .playing-card__corner--bottom {
    left: auto;
    right: 4px;
    top: auto;
    bottom: 3px;
    transform: rotate(180deg);
  }

  .playing-card__rank {
    font-size: 0.74rem;
  }

  .playing-card__suit {
    font-size: 0.58rem;
  }

  .playing-card__center {
    display: none;
  }

  .sound-toggle-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
  }

  .sound-toggle-btn__label {
    display: none;
  }

  .game-mobile-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 0.44rem;
  }

  .game-mobile-actions .btn:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .modal--settings {
    padding: 0.74rem;
    border-radius: 14px;
  }

  .settings-panel__head h3 {
    font-size: 0.95rem;
  }

  .settings-panel__head p {
    font-size: 0.76rem;
  }

  .modal__actions--settings .btn {
    flex-basis: 100%;
  }

  .game-table {
    --card-w: clamp(39px, 12.19vw, 49px);
    --tableau-down-gap: 5px;
    --tableau-up-gap: 10px;
    gap: 0.4rem;
    min-height: auto;
  }

  .tableau-piles {
    gap: 0.14rem;
  }

  .pile--tableau {
    min-height: max(calc(var(--card-h) + 86px), 188px);
  }

  .game-stat span {
    font-size: 0.69rem;
  }

  .game-stat strong {
    font-size: 0.9rem;
  }

  .game-mobile-actions {
    gap: 0.34rem;
    padding: 0.42rem;
  }

  .game-mobile-actions .btn {
    font-size: 0.78rem;
    padding: 0.44rem 0.5rem;
  }

  .playing-card__rank {
    font-size: 0.68rem;
  }

  .playing-card__suit {
    font-size: 0.52rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .playing-card,
  .hint-toast {
    transition-duration: 1ms;
  }
}

/* Settings modal v2 */
.modal.modal--settings {
  width: min(1040px, 92vw);
  max-height: 86vh;
  border-radius: 18px;
  border: 1px solid #dbe4de;
  background: #f8fbf9;
  box-shadow: 0 20px 48px rgba(10, 30, 23, 0.24);
  padding: 0;
  overflow: auto;
}

.modal--settings .modal__head {
  margin: 0;
  padding: 0.9rem 1rem 0.8rem;
  border-bottom: 1px solid #e3ebe7;
}

.modal--settings .modal__close {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid #d9e1dc;
  background: #f4f7f5;
  color: #13223a;
  font-size: 1.5rem;
  line-height: 1;
}

.settings-modal-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.settings-modal-brand__icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dbe4de;
  background: #f1f7f3;
  color: #17a35f;
}

.settings-modal-brand__icon svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.settings-modal-brand__text {
  display: grid;
  gap: 0.18rem;
}

.settings-modal-brand__text h2 {
  margin: 0;
  font-size: clamp(1.5rem, 1.7vw, 2rem);
  line-height: 1.08;
  color: #0f1b37;
}

.settings-modal-brand__text p {
  margin: 0;
  font-size: clamp(0.92rem, 0.95vw, 1.1rem);
  color: #637488;
}

.settings-form {
  gap: 0;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.7rem;
  padding: 0.75rem 1rem 0.85rem;
}

.settings-panel {
  border-radius: 16px;
  border: 1px solid #dbe4de;
  background: #fbfdfc;
  padding: 0.85rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.settings-panel__title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}

.settings-panel__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dbe4de;
  background: #f0f7f2;
  color: #19a35f;
  flex: 0 0 auto;
}

.settings-panel__icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.settings-panel__head {
  display: grid;
  gap: 0.2rem;
  margin: 0;
}

.settings-panel__head h3 {
  margin: 0;
  font-size: clamp(1.2rem, 1.2vw, 1.45rem);
  line-height: 1.1;
  color: #13213c;
}

.settings-panel__head p {
  margin: 0;
  font-size: clamp(0.86rem, 0.85vw, 0.95rem);
  color: #5c6f82;
}

.settings-fields.settings-fields--stacked {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.settings-item {
  display: grid;
  gap: 0.34rem;
}

.settings-item label {
  margin: 0;
  font-size: clamp(0.9rem, 0.9vw, 1rem);
  font-weight: 760;
  color: #162341;
}

.modal--settings select {
  width: 100%;
  min-height: 50px;
  border-radius: 12px;
  border: 1px solid #d7e1dc;
  background: #ffffff;
  color: #162341;
  padding: 0.5rem 0.9rem;
  font-size: clamp(1rem, 1vw, 1.1rem);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.modal--settings select:focus-visible,
.modal--settings input[type="range"]:focus-visible,
.settings-reset-btn:focus-visible,
.toggle:focus-within,
.modal--settings .modal__close:focus-visible {
  outline: 3px solid rgba(22, 163, 74, 0.28);
  outline-offset: 2px;
}

.settings-switches {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.toggle.toggle--card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 52px;
  border-radius: 12px;
  border: 1px solid #d7e1dc;
  background: #ffffff;
  padding: 0.45rem 0.7rem;
}

.toggle--card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle__box {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid #9aa6b2;
  background: #fefefe;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.toggle__box::after {
  content: "";
  width: 11px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
  opacity: 0;
}

.toggle__label {
  font-size: clamp(0.95rem, 0.95vw, 1.08rem);
  line-height: 1.15;
  color: #162341;
  font-weight: 760;
}

.toggle--card input:checked + .toggle__box {
  border-color: #1aa65f;
  background: #1aa65f;
}

.toggle--card input:checked + .toggle__box::after {
  opacity: 1;
}

.settings-audio {
  margin-top: 0.1rem;
  padding-top: 0.65rem;
  border-top: 1px solid #e3ebe7;
  display: grid;
  gap: 0.6rem;
}

.settings-audio.is-disabled {
  opacity: 0.5;
}

.volume-control {
  display: grid;
  gap: 0.35rem;
}

.volume-control label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0;
  font-size: clamp(0.9rem, 0.9vw, 0.98rem);
  font-weight: 750;
  color: #162341;
}

.volume-control__track {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.6rem;
}

.volume-control__icon {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.78;
}

.volume-control input[type="range"] {
  width: 100%;
  accent-color: #1aa65f;
}

.settings-note {
  margin-top: 0.7rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  border-radius: 12px;
  border: 1px solid #dce7e1;
  background: linear-gradient(170deg, #f4faf6, #edf5f1);
  padding: 0.65rem 0.75rem;
}

.settings-note__icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1aa65f;
  flex: 0 0 auto;
}

.settings-note__icon svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.settings-note__text {
  display: grid;
  gap: 0.36rem;
}

.settings-note strong {
  font-size: clamp(0.96rem, 0.95vw, 1.1rem);
  color: #17814e;
}

.settings-note p {
  margin: 0;
  font-size: clamp(0.82rem, 0.82vw, 0.92rem);
  color: #50636a;
  line-height: 1.35;
}

.modal--settings .modal__actions--settings {
  margin: 0;
  padding: 0.7rem 1rem 0.8rem;
  border-top: 1px solid #e3ebe7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.settings-reset-btn {
  min-height: 58px;
  border-radius: 12px;
  border: 1px solid #d6e0db;
  background: #f7faf8;
  color: #15233f;
  padding: 0.5rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  cursor: pointer;
}

.settings-reset-btn__icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #d6e0db;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #5b6775;
  flex: 0 0 auto;
}

.settings-reset-btn__icon svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.settings-reset-btn__text {
  display: grid;
  text-align: left;
  gap: 0.24rem;
}

.settings-reset-btn__text strong {
  font-size: clamp(0.92rem, 0.92vw, 1rem);
  line-height: 1.2;
}

.settings-reset-btn__text small {
  font-size: 0.8rem;
  color: #667588;
}

.settings-actions-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  margin-left: auto;
}

.settings-actions-right .btn {
  min-width: 134px;
  min-height: 48px;
  border-radius: 12px;
  font-size: 0.95rem;
}

@media (max-width: 1160px) {
  .modal.modal--settings {
    width: min(980px, 95vw);
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .modal.modal--settings {
    width: min(98vw, 760px);
    border-radius: 20px;
  }

  .modal--settings .modal__head {
    padding: 0.95rem;
  }

  .modal--settings .modal__close {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    font-size: 1.8rem;
  }

  .settings-modal-brand {
    gap: 0.66rem;
  }

  .settings-modal-brand__icon {
    width: 56px;
    height: 56px;
  }

  .settings-modal-brand__icon svg {
    width: 32px;
    height: 32px;
  }

  .settings-layout {
    padding: 0.85rem;
    gap: 0.85rem;
  }

  .settings-panel {
    padding: 0.9rem;
    border-radius: 16px;
  }

  .settings-panel__title-row {
    gap: 0.6rem;
    margin-bottom: 0.7rem;
  }

  .settings-panel__icon {
    width: 44px;
    height: 44px;
  }

  .settings-panel__icon svg {
    width: 24px;
    height: 24px;
  }

  .modal--settings select {
    min-height: 56px;
    font-size: 1.05rem;
  }

  .toggle.toggle--card {
    min-height: 58px;
    padding: 0.62rem 0.68rem;
    gap: 0.62rem;
  }

  .toggle__box {
    width: 28px;
    height: 28px;
  }

  .toggle__label {
    font-size: 1rem;
  }

  .settings-note {
    margin-top: 0.9rem;
    padding: 0.8rem;
  }

  .modal--settings .modal__actions--settings {
    padding: 0.8rem 0.95rem 1rem;
  }

  .settings-reset-btn {
    width: 100%;
    min-height: 72px;
  }

  .settings-actions-right {
    width: 100%;
    margin-left: 0;
  }

  .settings-actions-right .btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 56px;
    font-size: 1rem;
  }
}

@media (max-width: 540px) {
  .settings-modal-brand__text h2 {
    font-size: 1.65rem;
  }

  .settings-modal-brand__text p {
    font-size: 0.95rem;
  }

  .settings-item label {
    font-size: 0.93rem;
  }

  .modal--settings select {
    min-height: 52px;
    border-radius: 14px;
    font-size: 1rem;
  }

  .settings-reset-btn__text small {
    font-size: 0.85rem;
  }
}
