:root {
  color-scheme: dark;
  --ink: #eef4ee;
  --muted: #aab9b2;
  --line: rgba(255, 255, 255, 0.14);
  --panel: #173b35;
  --panel-2: #102f2b;
  --table: #0b2724;
  --gold: #e2bf63;
  --danger: #e57d78;
  --card-w: clamp(78px, 7.25vw, 112px);
  --card-h: calc(var(--card-w) * 1.3968);
  --noble: clamp(76px, 7vw, 106px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--table); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(8, 33, 30, 0.94), rgba(8, 33, 30, 0.96)),
    url("assets/table-texture.webp") center / cover fixed;
  letter-spacing: 0;
}

button, input { min-width: 0; font: inherit; letter-spacing: 0; }
button { max-width: 100%; color: inherit; line-height: 1.25; overflow-wrap: anywhere; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button:not(:disabled) { cursor: pointer; }
.hidden { display: none !important; }
.mobile-only { display: none; }

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 64px;
  padding: 0 max(20px, calc((100vw - 1520px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(9, 35, 32, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 205px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(226, 191, 99, .65);
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 25px;
}

.brand strong, .mode-brand { font-family: Georgia, serif; letter-spacing: 2px; }
.brand small, .mode-brand small { display: block; margin-top: 1px; color: var(--muted); font-family: inherit; font-size: 11px; letter-spacing: 1px; }

.desktop-nav { display: flex; gap: 4px; margin-left: auto; }
.desktop-nav button, footer button, .mobile-menu button {
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.desktop-nav button:hover, footer button:hover { color: var(--ink); }

.room-chip {
  order: 1;
  padding: 7px 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.room-chip strong { margin-left: 4px; color: var(--gold); letter-spacing: 1px; }

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 22px;
}

.mobile-menu {
  position: fixed;
  z-index: 29;
  top: 64px;
  left: 0;
  right: 0;
  display: none;
  padding: 10px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: #102f2b;
}
.mobile-menu.open { display: grid; }
.mobile-menu button { text-align: left; }

.game-shell { width: min(1520px, 100%); margin: 0 auto; padding: 14px 20px 40px; }
.game-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 7px 0 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.game-status > div { display: flex; align-items: center; gap: 8px; }
.game-status strong { color: var(--ink); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #64756e; }
.status-dot.active { background: #71c491; box-shadow: 0 0 0 4px rgba(113, 196, 145, .12); }

.players-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(155px, 1fr));
  gap: 1px;
  margin: 12px 0;
  background: var(--line);
  border: 1px solid var(--line);
}

.player-panel { min-width: 0; padding: 10px 12px; background: rgba(16, 47, 43, .94); }
.player-panel.current { box-shadow: inset 0 3px var(--gold); }
.player-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.player-score { color: var(--gold); font-family: Georgia, serif; font-size: 19px; }
.player-meta { display: flex; align-items: center; gap: 9px; margin-top: 7px; color: var(--muted); font-size: 11px; }
.mini-gems { display: flex; gap: 3px; margin-top: 8px; }
.mini-gem { display: inline-flex; align-items: center; justify-content: center; width: 25px; height: 21px; border: 1px solid rgba(255,255,255,.22); color: white; font-size: 10px; font-weight: 700; text-shadow: 0 1px 2px #000; }

.board-layout { display: grid; grid-template-columns: minmax(0, 1fr) 285px; gap: 18px; align-items: start; }
.market-area { min-width: 0; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.section-heading small { color: var(--muted); font-size: 10px; font-weight: 400; }

.nobles-band { padding: 12px 14px; border: 1px solid var(--line); background: rgba(16, 47, 43, .65); }
.nobles-list { display: flex; gap: 10px; min-height: var(--noble); overflow-x: auto; }
.noble-tile {
  position: relative;
  width: var(--noble);
  height: var(--noble);
  flex: 0 0 var(--noble);
  overflow: hidden;
  border: 2px solid #b99850;
  background: #2a403c center / cover;
  box-shadow: 0 6px 13px rgba(0,0,0,.25);
  padding: 0;
  text-align: left;
  transition: transform .14s ease, box-shadow .14s ease;
}
.noble-tile:hover { transform: translateY(-3px); box-shadow: 0 9px 18px rgba(0,0,0,.36); }
.noble-score { position: absolute; top: 4px; left: 4px; display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid #f0d895; background: rgba(24, 18, 10, .88); color: #fff0b4; font-weight: 800; }
.noble-cost { position: absolute; right: 4px; bottom: 4px; left: 4px; display: flex; gap: 3px; justify-content: center; padding: 3px; background: rgba(5, 19, 17, .88); }

.market { display: grid; gap: 8px; margin-top: 10px; }
.market-row {
  display: grid;
  grid-template-columns: 72px repeat(4, var(--card-w));
  gap: 9px;
  align-items: center;
  min-height: calc(var(--card-h) + 18px);
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: rgba(16, 47, 43, .7);
}
.deck-stack { display: grid; justify-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.deck-back { display: grid; width: 54px; height: 75px; place-items: center; border: 2px solid rgba(255,255,255,.46); background: #163d37; box-shadow: 4px 4px 0 #0b2421, 7px 7px 0 rgba(255,255,255,.12); color: var(--gold); font-family: Georgia, serif; font-size: 24px; }
.tier-2 .deck-back { background: #6e5626; }
.tier-3 .deck-back { background: #183a59; }

.development-card {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.48);
  border-radius: 3px;
  background: #223b36 center / cover no-repeat;
  box-shadow: 0 5px 12px rgba(0,0,0,.28);
  transition: transform .14s ease, box-shadow .14s ease;
}
.development-card:not(:disabled):hover { z-index: 4; transform: translateY(-4px); box-shadow: 0 10px 24px rgba(0,0,0,.4); }
.development-card.inspect-only { filter: saturate(.78); }
.card-top { position: absolute; top: 4px; right: 4px; left: 4px; display: flex; align-items: flex-start; justify-content: space-between; }
.card-points { display: grid; min-width: 28px; height: 30px; place-items: center; padding: 0 6px; border: 1px solid rgba(255,255,255,.68); background: rgba(5,17,15,.9); font-family: Georgia, serif; font-size: 21px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.card-points.zero { visibility: hidden; }
.bonus-gem { display: grid; width: 31px; height: 31px; place-items: center; border: 2px solid rgba(255,255,255,.7); transform: rotate(45deg); box-shadow: 0 2px 5px #0008; }
.bonus-gem::after { content: ""; width: 10px; height: 10px; border: 1px solid rgba(255,255,255,.74); }
.card-cost { position: absolute; right: 4px; bottom: 4px; left: 4px; display: flex; flex-wrap: wrap-reverse; gap: 3px; align-items: flex-end; min-height: 28px; padding: 3px; background: rgba(5, 18, 16, .9); }
.cost-gem { display: inline-grid; min-width: 21px; height: 21px; place-items: center; border: 1px solid rgba(255,255,255,.68); color: #fff; font-size: 11px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.affordable { box-shadow: 0 0 0 2px #7bd39b, 0 5px 12px rgba(0,0,0,.28); }
.card-menu { position: absolute; z-index: 12; display: grid; min-width: 130px; padding: 5px; border: 1px solid var(--line); background: #09231f; box-shadow: 0 10px 30px #0008; }
.card-menu button { padding: 9px 10px; border: 0; background: transparent; text-align: left; font-size: 12px; }
.card-menu button:hover:not(:disabled) { background: rgba(255,255,255,.08); }
.card-menu button:disabled { color: #6d7f77; }

.action-rail { position: sticky; top: 78px; display: grid; gap: 12px; }
.bank-panel, .reserved-panel, .event-log { padding: 14px; border: 1px solid var(--line); background: rgba(16,47,43,.88); }
.gem-bank { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.gem-button, .return-gem {
  position: relative;
  display: grid;
  min-height: 63px;
  place-items: center;
  padding: 5px;
  border: 1px solid rgba(255,255,255,.26);
  background: rgba(255,255,255,.04);
}
.gem-button.selected { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.gem-disc { display: grid; width: 38px; height: 38px; place-items: center; border: 2px solid rgba(255,255,255,.65); border-radius: 50%; box-shadow: inset 0 0 0 4px rgba(255,255,255,.14), 0 2px 5px #0008; color: white; font-size: 12px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.gem-button small { position: absolute; right: 5px; bottom: 3px; color: var(--muted); font-size: 9px; }
.selection-summary { min-height: 30px; margin-top: 8px; padding: 7px; background: rgba(0,0,0,.16); color: var(--muted); font-size: 11px; }

.primary-button, .secondary-button, .quiet-button, .danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: 9px 15px;
  border: 1px solid transparent;
  font-weight: 700;
  text-align: center;
  white-space: normal;
}
.primary-button { background: var(--gold); color: #152a26; }
.primary-button:hover:not(:disabled) { background: #f1d57f; }
.primary-button:disabled { opacity: .42; cursor: not-allowed; }
.secondary-button { border-color: var(--gold); background: transparent; color: var(--gold); }
.quiet-button { border-color: var(--line); background: transparent; color: var(--muted); }
.danger-button { border-color: #e57d78; background: #b94f4b; color: white; }
.danger-button:hover { background: #cc5c57; }
.wide { width: 100%; margin-top: 7px; }

.reserved-list { display: flex; gap: 7px; min-height: 80px; overflow-x: auto; }
.reserved-list .development-card { --card-w: 64px; flex: 0 0 64px; }
.empty-note { align-self: center; width: 100%; color: var(--muted); font-size: 11px; text-align: center; }

.event-log { margin-top: 16px; }
.event-log ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 20px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 11px; }
.event-log li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

footer { display: flex; align-items: center; justify-content: center; gap: 18px; min-height: 55px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

dialog {
  max-width: calc(100vw - 28px);
  padding: 0;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 4px;
  color: var(--ink);
  background: #102f2b;
  box-shadow: 0 25px 80px rgba(0,0,0,.62);
}
dialog::backdrop { background: rgba(2, 13, 12, .84); backdrop-filter: blur(5px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 20px; }
.mode-dialog { width: min(560px, calc(100vw - 28px)); }
.mode-dialog::backdrop { background: radial-gradient(circle at center, rgba(21, 66, 58, .93), rgba(2, 13, 12, .98)); }
.mode-brand { display: flex; align-items: center; gap: 10px; }
.mode-content { padding: 26px; }
.mode-content h1, .mode-content h2 { margin: 0 0 22px; font-family: Georgia, serif; font-size: 27px; font-weight: 500; text-align: center; }
.mode-options { display: grid; gap: 10px; }
.mode-option { display: grid; grid-template-columns: 46px 1fr 20px; align-items: center; gap: 12px; min-height: 88px; padding: 13px; border: 1px solid var(--line); background: rgba(255,255,255,.03); text-align: left; }
.mode-option { width: 100%; grid-template-columns: 46px minmax(0, 1fr) 20px; }
.mode-option:hover { border-color: var(--gold); background: rgba(226,191,99,.07); }
.mode-option strong { display: block; margin-bottom: 4px; font-size: 16px; }
.mode-option small { display: block; color: var(--muted); font-size: 12px; }
.mode-icon { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid var(--gold); color: var(--gold); font-size: 23px; }
.back-button { margin: -12px 0 14px; padding: 7px 0; border: 0; background: transparent; color: var(--muted); }
.mode-content label > span, fieldset legend { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.mode-content input[type="text"], .mode-content input:not([type]) { width: 100%; height: 42px; padding: 8px 10px; border: 1px solid var(--line); background: rgba(0,0,0,.18); color: var(--ink); }
.mode-content fieldset { margin: 17px 0; padding: 0; border: 0; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); }
.segmented label { position: relative; margin: 0; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: grid !important; height: 40px; place-items: center; margin: 0 !important; color: var(--muted) !important; }
.segmented input:checked + span { background: var(--gold); color: #152a26 !important; font-weight: 700; }
.multi-actions { display: grid; }
.or { display: flex; align-items: center; gap: 9px; margin: 12px 0; color: var(--muted); font-size: 10px; }
.or::before, .or::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.form-error { min-height: 18px; margin: 8px 0 0; color: var(--danger); font-size: 11px; }

.lobby-dialog { width: min(470px, calc(100vw - 28px)); }
.lobby-dialog > :not(.dialog-header) { margin-right: 18px; margin-left: 18px; }
.lobby-dialog .wide:last-child { width: calc(100% - 36px); margin: 12px 18px 18px; }
.invite-line { display: flex; align-items: center; justify-content: space-between; margin-top: 15px; padding: 9px 11px; background: rgba(0,0,0,.16); color: var(--muted); font-size: 11px; }
.invite-line > span { min-width: 0; overflow-wrap: anywhere; }
.invite-line button { border: 0; background: transparent; color: var(--gold); }
.lobby-players { display: grid; gap: 6px; margin-top: 12px; }
.lobby-player { display: flex; align-items: center; justify-content: space-between; min-height: 45px; padding: 8px 10px; border: 1px solid var(--line); }
.lobby-player > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-player small { color: var(--muted); }
.lobby-player-actions { display: flex; align-items: center; gap: 8px; }
.ready-badge { color: #83d9a2; font-size: 11px; }
.kick-button { display: grid; width: 28px; height: 28px; place-items: center; padding: 0; border: 1px solid rgba(229,125,120,.4); background: transparent; color: var(--danger); }
.lobby-note { color: var(--muted); font-size: 11px; }

.rules-drawer { width: min(620px, calc(100vw - 28px)); max-height: min(780px, calc(100vh - 28px)); margin-right: 14px; }
.rules-body { padding: 4px 22px 22px; overflow-y: auto; }
.rules-body section { padding: 12px 0; border-bottom: 1px solid var(--line); }
.rules-body h3 { margin: 0 0 7px; color: var(--gold); font-size: 14px; }
.rules-body p, .rules-body ol { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }

.return-dialog { width: min(440px, calc(100vw - 28px)); padding-bottom: 16px; }
.return-dialog > p, .return-dialog > .return-bank, .return-dialog > .wide { margin-right: 18px; margin-left: 18px; width: calc(100% - 36px); }
.return-dialog > p { color: var(--muted); font-size: 12px; }
.return-bank { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.return-gem.selected { border-color: var(--gold); }

.game-over-dialog { width: min(420px, calc(100vw - 28px)); padding: 28px; text-align: center; }
.game-over-dialog .trophy { margin: 0 auto 14px; color: var(--gold); font-size: 44px; }
.game-over-dialog h2 { margin: 0 0 8px; font-family: Georgia, serif; }
.game-over-dialog p { color: var(--muted); font-size: 12px; line-height: 1.6; }

.piece-detail-dialog { width: min(760px, calc(100vw - 28px)); }
.piece-detail-layout { display: grid; grid-template-columns: minmax(230px, .9fr) minmax(260px, 1.1fr); gap: 22px; padding: 22px; }
.piece-detail-media { display: grid; min-width: 0; place-items: center; padding: 12px; background: rgba(0,0,0,.2); }
.piece-detail-media img { display: block; width: min(100%, 310px); max-height: min(64vh, 520px); object-fit: contain; border: 1px solid rgba(255,255,255,.38); box-shadow: 0 14px 28px rgba(0,0,0,.36); }
.piece-detail-dialog[data-kind="card"] .piece-detail-media img { aspect-ratio: 63 / 88; }
.piece-detail-dialog[data-kind="noble"] .piece-detail-media img { width: min(100%, 360px); aspect-ratio: 1; border-radius: 5%; }
.piece-detail-info { display: flex; min-width: 0; flex-direction: column; gap: 10px; }
.detail-stat { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); background: rgba(255,255,255,.035); font-size: 13px; }
.detail-stat strong { color: var(--gold); font-family: Georgia, serif; font-size: 23px; }
.detail-requirements { margin-top: 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.detail-requirements h3 { margin: 0 0 9px; color: var(--muted); font-size: 12px; font-weight: 600; }
#pieceDetailRequirements { display: grid; gap: 6px; }
.requirement-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 39px; padding: 7px 9px; background: rgba(0,0,0,.17); font-size: 12px; }
.requirement-row > span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.requirement-row .cost-gem { flex: 0 0 23px; width: 23px; }
.piece-detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: auto; padding-top: 10px; }
.piece-detail-actions:empty { display: none; }
.piece-detail-actions button { width: 100%; }

.confirm-dialog { width: min(430px, calc(100vw - 28px)); }
.confirm-dialog > p { margin: 0; padding: 20px 20px 10px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.confirm-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 12px 20px 20px; }
.confirm-actions button { width: 100%; }

.toast { position: fixed; z-index: 80; right: 20px; bottom: 20px; max-width: 310px; padding: 10px 14px; border: 1px solid var(--line); background: #071d1a; color: var(--ink); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

.gem-green { background: #278b59; }
.gem-white { background: #e7e3d4; color: #20312d; text-shadow: none; }
.gem-blue { background: #2879b6; }
.gem-black { background: #292d2d; }
.gem-red { background: #ba4545; }
.gem-gold { background: #bc9132; }

@media (max-width: 1050px) {
  :root { --card-w: clamp(70px, 8.5vw, 94px); }
  .board-layout { grid-template-columns: minmax(0, 1fr) 238px; }
  .market-row { grid-template-columns: 58px repeat(4, var(--card-w)); gap: 6px; padding: 8px; }
  .event-log ol { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 780px) {
  :root { --card-w: clamp(66px, 18.5vw, 104px); --noble: 78px; }
  .desktop-nav { display: none; }
  .mobile-only { display: grid; }
  .topbar { gap: 10px; height: 58px; padding: 0 12px; }
  .brand { min-width: 0; }
  .brand-mark { width: 34px; height: 34px; }
  .brand strong { font-size: 13px; }
  .brand small { font-size: 9px; }
  .room-chip { margin-left: auto; }
  .mobile-menu { top: 58px; }
  .game-shell { padding: 8px 9px 28px; }
  .game-status { align-items: flex-start; }
  .game-status > div { align-items: flex-start; flex-wrap: wrap; }
  .players-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board-layout { display: flex; flex-direction: column; }
  .market-area, .action-rail { width: 100%; }
  .action-rail { position: static; order: -1; }
  .reserved-panel { display: none; }
  .bank-panel { padding: 10px; }
  .gem-bank { grid-template-columns: repeat(6, minmax(44px, 1fr)); }
  .gem-button { min-height: 58px; }
  .gem-disc { width: 34px; height: 34px; }
  .selection-summary { min-height: 26px; }
  .bank-panel .wide { display: flex; width: 100%; }
  .market { gap: 6px; }
  .market-row { grid-template-columns: repeat(4, var(--card-w)); justify-content: space-between; min-height: calc(var(--card-h) + 56px); padding: 7px; }
  .deck-stack { grid-column: 1 / -1; grid-row: 1; grid-template-columns: 40px auto; justify-self: start; align-items: center; }
  .deck-back { width: 34px; height: 46px; box-shadow: 2px 2px 0 #0b2421; font-size: 16px; }
  .event-log ol { grid-template-columns: 1fr; }
  footer { flex-wrap: wrap; gap: 4px 12px; padding: 10px; }
  .mode-content { padding: 20px 16px; }
  .piece-detail-layout { grid-template-columns: minmax(120px, .82fr) minmax(145px, 1.18fr); gap: 12px; padding: 12px; }
  .piece-detail-media { padding: 7px; }
  .piece-detail-media img { max-height: 58vh; }
  .detail-stat { min-height: 42px; padding: 8px; }
  .piece-detail-actions { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  :root { --card-w: calc((100vw - 45px) / 4); }
  .room-chip span { display: none; }
  .players-strip { margin: 8px 0; }
  .player-panel { padding: 8px; }
  .player-meta { gap: 5px; }
  .mini-gem { width: 21px; }
  .nobles-band { padding: 9px; }
  .gem-bank { grid-template-columns: repeat(3, 1fr); }
  .market-row { gap: 4px; }
  .development-card { border-radius: 2px; }
  .cost-gem { min-width: 18px; height: 18px; font-size: 10px; }
  .card-cost { gap: 2px; padding: 2px; }
  .bonus-gem { width: 26px; height: 26px; }
  .card-points { min-width: 24px; height: 26px; font-size: 17px; }
  .section-heading small { max-width: 170px; text-align: right; }
  .dialog-header { gap: 10px; padding: 13px 14px; }
  .dialog-header h2 { min-width: 0; font-size: 17px; overflow-wrap: anywhere; }
  .piece-detail-layout { grid-template-columns: minmax(105px, .78fr) minmax(135px, 1.22fr); gap: 9px; padding: 9px; }
  .piece-detail-media { padding: 5px; align-self: start; }
  .detail-stat { display: grid; gap: 4px; min-height: 0; padding: 7px; }
  .detail-stat strong { font-size: 18px; }
  .requirement-row { min-height: 34px; padding: 5px 7px; }
  .confirm-actions { padding-right: 14px; padding-left: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
