.select-screen {
  background: linear-gradient(90deg, #ffffffdc, #ffffff75 58%, #ffffff20),
    url("/ai-lifegame9/assets/world-adventure.jpeg") center / cover fixed;
  padding: 28px 22px;
}
.game-panel {
  position: relative;
  border: 6px solid #75491f;
  border-radius: 28px;
  background: #fffdf0ec;
  padding: clamp(24px, 4vw, 46px);
  box-shadow: 0 12px 0 #54341466, 0 25px 55px #1d140b55;
}
.settings-button {
  position: absolute;
  top: 20px;
  right: 22px;
  border: 2px solid #e7bd53;
  border-radius: 999px;
  padding: 10px 17px;
  background: linear-gradient(#fffdf3, #fff0bb);
  color: #654418;
  font-weight: 900;
  box-shadow: 0 4px 0 #bd8730;
  cursor: pointer;
}
.settings-screen { min-height: 100vh; display: grid; place-items: center; }
.settings-panel { width: min(720px, calc(100% - 28px)); padding: 42px; text-align: center; }
.settings-panel h1 { color: #573b20; font-size: clamp(30px, 5vw, 46px); }
.setting-row {
  margin: 28px 0;
  padding: 24px;
  border: 3px solid #e6bd55;
  border-radius: 20px;
  background: linear-gradient(135deg, #fffdf0, #fff3bd);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  text-align: left;
}
.setting-row b { display: block; color: #523717; font-size: 20px; }
.setting-row small { display: block; margin-top: 7px; color: #806944; font-weight: 700; }
.voice-toggle { width: 116px; padding: 7px; border: 0; border-radius: 999px; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 900; color: white; }
.voice-toggle i { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; background: white; box-shadow: 0 2px 6px #0004; }
.voice-toggle.on { background: linear-gradient(90deg, #10b981, #35d399); }
.voice-toggle.off { background: linear-gradient(90deg, #778093, #9aa2b1); flex-direction: row-reverse; }
.game-panel .ribbon {
  background: linear-gradient(#ffca45, #f27816);
  color: #fff;
  clip-path: polygon(0 13%, 100% 0, 96% 100%, 5% 90%);
  border-radius: 0;
  text-shadow: 0 2px 0 #8d3e09;
}
.game-panel h1 {
  color: #008b72;
  text-shadow: 0 5px 0 #fff0b1, 0 9px 15px #0002;
}
.character-card {
  position: relative;
  border: 4px solid #d8aa52;
  border-radius: 20px;
  background: linear-gradient(#fff, #fff8df);
  box-shadow: 0 7px 0 #9b672f55;
  color: #39291e;
}
.character-card.conquered { border-color: #f0b429; box-shadow: 0 7px 0 #9b672f55, 0 0 22px #ffd84a88; }
.clear-badge { position: absolute; z-index: 2; top: 8px; right: 8px; padding: 5px 8px; border: 2px solid #fff2a6; border-radius: 999px; background: linear-gradient(#ffc83d, #ed7511); color: white; font-size: 10px; font-weight: 1000; box-shadow: 0 3px 0 #8b470e; }
.character-card:hover,
.character-card:focus-visible {
  transform: translateY(-7px);
  border-color: var(--accent);
  box-shadow: 0 10px 0 color-mix(in srgb, var(--accent) 55%, #75491f);
}
.character-sprite {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin-bottom: 12px;
  border: 4px solid var(--accent);
  border-radius: 12px;
  background-image: url("/ai-lifegame13/assets/characters.webp");
  background-repeat: no-repeat;
  background-size: 500% 200%;
  background-position: calc(var(--char-col) * 25%) 0;
  box-shadow: inset 0 -8px 0 #0000000c;
}
.game-header .character-avatar {
  width: 48px;
  height: 48px;
  margin: 0;
  border-width: 2px;
  border-radius: 50%;
}
.character-card strong {
  background: linear-gradient(#ffcc4e, #f48117);
  color: #3b2100;
  border: 2px solid #75491f;
  border-radius: 999px;
}
.rules {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}
.rules > * {
  background: #fff3c9;
  border: 2px solid #dfb353;
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 800;
}
.record-board {
  margin: 0 auto 26px;
  padding: 15px;
  border: 4px solid #263f72;
  border-radius: 16px;
  background: linear-gradient(180deg, #152b52, #091630);
  color: #fff;
  box-shadow: 0 7px 0 #07102788, inset 0 0 24px #53b6ff18;
  text-align: left;
}
.record-title { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.record-title > span { font-size: 24px; }
.record-title b { color: #ffe36b; font-size: 17px; }
.record-title small { margin-left: auto; color: #8bd6ff; font-weight: 900; }
.record-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.record-grid article { padding: 11px 13px; border: 2px solid #527eb6; border-radius: 11px; background: #1a3763; }
.record-grid article > span, .record-grid article > small { display: block; color: #abd9ff; font-size: 10px; font-weight: 900; }
.record-grid strong { display: block; margin: 3px 0; color: #fff; font-size: 20px; }
.record-meter > div { height: 10px; margin-top: 7px; overflow: hidden; border: 2px solid #718bb2; border-radius: 99px; background: #071126; }
.record-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #25d69b, #ffe25d); box-shadow: 0 0 10px #5bffd0; }
.record-meter.time i { background: linear-gradient(90deg, #59b8ff, #ce8cff); box-shadow: 0 0 10px #82c8ff; }
.record-board.empty { text-align: center; }
.record-board.empty > div { display: flex; justify-content: center; align-items: center; gap: 8px; color: #ffe36b; }
.record-board.empty p { margin: 5px 0 0; color: #c9ddf5; font-size: 13px; }
.conquest-head { display: flex; justify-content: space-between; gap: 12px; margin: 16px 2px 7px; color: #ffe36b; }
.conquest-head span { color: #a9d9ff; font-size: 12px; font-weight: 900; }
.conquest-meter { height: 14px; overflow: hidden; border: 2px solid #718bb2; border-radius: 999px; background: #050d21; }
.conquest-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #31d7a1, #ffdd50, #ff8d35); box-shadow: 0 0 13px #ffe15a; transition: width .4s ease; }
.conquest-roster { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-top: 11px; }
.conquest-roster > div { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; border: 1px solid #527eb6; border-radius: 9px; background: #112a50; }
.conquest-roster .cleared { border-color: #e9bc42; background: linear-gradient(#55451d, #2d2b2a); }
.conquest-roster b { font-size: 11px; }
.conquest-roster small { color: #acd9ff; font-size: 9px; font-weight: 900; }
.speak-button { display: block; margin: 17px 0 -8px auto; padding: 9px 14px; border: 2px solid #3e79b9; border-radius: 999px; background: linear-gradient(#e8f7ff, #b9e4ff); color: #173a68; font-weight: 900; box-shadow: 0 4px 0 #245787; }
.speak-button:active { transform: translateY(3px); box-shadow: 0 1px 0 #245787; }
.speak-button.muted { background: #e7e9ee; color: #596174; border-color: #9ca3af; }
.quiz-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin: 17px 0 -8px; }
.quiz-actions .speak-button { margin: 0; }
.restart-button { padding: 9px 14px; border: 2px solid #d79534; border-radius: 999px; background: linear-gradient(#fff8dc, #ffd88b); color: #68400d; font-weight: 900; box-shadow: 0 4px 0 #a96420; cursor: pointer; }
.restart-button:active { transform: translateY(3px); box-shadow: 0 1px 0 #a96420; }
.game-header {
  height: auto;
  min-height: 74px;
  padding-block: 9px;
}
.game-hud {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) repeat(3, minmax(105px, auto));
  gap: 10px;
  padding: 10px 22px 14px;
  background: linear-gradient(180deg, #162647f2, #08132ff2);
  border-bottom: 4px solid #f6b933;
  box-shadow: 0 6px 0 #06102888;
}
.game-hud .change-character { grid-row: 1; }
.hud-player { min-width: 0; }
.game-header .hud-player > span { display: grid; gap: 1px; font-size: inherit; }
.hud-player small, .hud-stat small {
  color: #9edbff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .13em;
}
.hud-player b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-header .hud-stat {
  display: grid;
  align-content: center;
  min-height: 52px;
  padding: 6px 14px;
  border: 2px solid #75b9ef;
  border-radius: 10px;
  background: linear-gradient(180deg, #203e6f, #12264c);
  box-shadow: inset 0 0 12px #4cc9ff22, 0 3px 0 #030a1d88;
}
.game-header .hud-stat strong {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  padding: 0;
  font-size: 18px;
  text-shadow: 0 2px 0 #000;
}
.game-header .hud-stat span { font-size: inherit; }
.hud-max { border-color: #ffd45e; }
.hud-max small { color: #ffe895; }
.hud-max strong { color: #fff3a6 !important; }
.hud-time { border-color: #61e6b7; }
.hud-time small { color: #8dffd7; }
.game-header .hud-progress { grid-column: 2 / -1; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.hud-progress > span { display: flex; gap: 8px; align-items: center; font-size: 11px; }
.hud-progress small { color: #b9c8e6; }
.hud-progress > div { height: 11px; overflow: hidden; border: 2px solid #7082a8; border-radius: 99px; background: #050c20; }
.hud-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #24d697, #ffe25f); box-shadow: 0 0 12px #43f3bd; transition: width .35s ease; }
.result-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.result-stats .score {
  font-size: 48px;
  background: #f6f1e7;
  border-radius: 18px;
  padding: 12px 20px;
  margin: 12px;
}
.result-stats .time-score { color: #375b94; }
@media (max-width: 850px) {
  .settings-button { position: static; float: right; margin-bottom: 8px; }
  .settings-panel { padding: 30px 18px; }
  .setting-row { align-items: stretch; flex-direction: column; }
  .game-hud { grid-template-columns: auto 1fr 1fr; gap: 7px; padding: 8px 10px 11px; }
  .game-hud .change-character { grid-column: 1; }
  .hud-player { grid-column: 2 / -1; }
  .hud-stat { min-height: 45px; padding: 5px 8px; }
  .game-header .hud-stat strong { font-size: 14px; }
  .hud-score { grid-column: 1; }
  .hud-max { grid-column: 2; }
  .hud-time { grid-column: 3; }
  .game-header .hud-progress { grid-column: 1 / -1; }
  .record-grid { grid-template-columns: 1fr; }
  .conquest-roster { grid-template-columns: repeat(5, minmax(54px, 1fr)); overflow-x: auto; }
}
@media (max-width: 460px) {
  .quiz-actions { align-items: stretch; flex-direction: column; }
  .quiz-actions > button { width: 100%; }
  .hud-player b { font-size: 12px; }
  .hud-stat small { font-size: 8px; }
  .game-header .hud-stat strong { font-size: 12px; }
  .hud-progress { grid-template-columns: auto 1fr; }
}
