:root {
  --bg: #f6f5ef;
  --surface: #ffffff;
  --surface-soft: #eff7f3;
  --ink: #17332f;
  --muted: #6d7e79;
  --line: #dde7e2;
  --green: #176b65;
  --green-dark: #0e4d49;
  --mint: #62d3b4;
  --yellow: #ffc857;
  --orange: #ff8f5a;
  --red: #e55864;
  --blue: #5b7cfa;
  --shadow: 0 18px 50px rgba(24, 68, 61, .11);
  --soft-shadow: 0 9px 26px rgba(24, 68, 61, .08);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(98, 211, 180, .25), transparent 30rem),
    radial-gradient(circle at 92% 18%, rgba(255, 200, 87, .2), transparent 25rem),
    var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(91, 124, 250, .32);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.18;
  letter-spacing: -.03em;
}

h1 {
  font-size: clamp(1.7rem, 7vw, 2.5rem);
}

h2 {
  font-size: 1.36rem;
}

.loading-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  align-content: center;
  gap: 16px;
  color: var(--muted);
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: max(13px, env(safe-area-inset-top)) 18px 13px;
  align-items: center;
  justify-content: space-between;
  background: rgba(246, 245, 239, .86);
  border-bottom: 1px solid rgba(221, 231, 226, .76);
  backdrop-filter: blur(18px);
}

.brand-lockup,
.header-actions,
.card-title-row,
.page-title-row,
.session-topbar,
.word-card-top,
.fighter-name,
.battle-word-row,
.arena-topbar {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 10px;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 1rem;
  letter-spacing: -.02em;
}

.brand-lockup small {
  margin-top: -2px;
  color: var(--muted);
  font-size: .64rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--green), #2ca38d);
  border-radius: 13px 13px 13px 5px;
  box-shadow: 0 8px 18px rgba(23, 107, 101, .24);
  font-weight: 900;
}

.brand-mark.large {
  width: 58px;
  height: 58px;
  border-radius: 20px 20px 20px 8px;
  font-size: 1.6rem;
}

.header-actions {
  gap: 7px;
}

.header-stat,
.header-install,
.point-badge,
.bank-pill,
.small-badge,
.combo-badge,
.skill-pill {
  white-space: nowrap;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
}

.header-stat {
  padding: 7px 9px;
  color: var(--green-dark);
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(221, 231, 226, .86);
}

.header-install {
  padding: 7px 10px;
  color: #fff;
  background: var(--green);
  border: 0;
}

.app-main {
  width: min(100%, 760px);
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 18px 16px calc(108px + env(safe-area-inset-bottom));
}

.page-section {
  display: flex;
  flex-direction: column;
  gap: 17px;
  animation: pageIn .32s ease both;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--green);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.muted,
.subtle-note {
  color: var(--muted);
  font-size: .87rem;
}

.subtle-note {
  margin: 0 4px;
  text-align: center;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.creature-button,
.level-button {
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 15px;
  font-weight: 850;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--green), #269b84);
  border: 0;
  box-shadow: 0 11px 24px rgba(23, 107, 101, .22);
}

.primary-button:active,
.secondary-button:active,
.creature-button:active,
.level-button:active {
  transform: scale(.98);
}

.secondary-button {
  color: var(--green);
  background: #e9f5f1;
  border: 1px solid #d5ebe4;
}

.danger-button {
  color: #fff;
  background: var(--red);
  border: 0;
}

.text-button {
  color: var(--muted);
  background: transparent;
  border: 0;
  box-shadow: none;
}

.wide-button {
  width: 100%;
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 28px 24px;
  color: #fff;
  background: linear-gradient(145deg, #0f5b57, #238c78 68%, #55c7a4);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero-card .eyebrow {
  color: #c8fff0;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 27rem;
  margin-bottom: 22px;
  color: rgba(255, 255, 255, .82);
}

.hero-card h1 {
  position: relative;
  z-index: 1;
  max-width: 18rem;
  margin-bottom: 12px;
}

.hero-orb {
  position: absolute;
  width: 190px;
  height: 190px;
  right: -50px;
  top: -62px;
  background: radial-gradient(circle at 30% 30%, #fff7bf, #ffc857 40%, rgba(255, 200, 87, 0));
  border-radius: 50%;
  opacity: .78;
  filter: blur(2px);
}

.study-hero::after {
  position: absolute;
  width: 100px;
  height: 100px;
  right: 28px;
  bottom: -62px;
  content: "";
  background: rgba(255, 255, 255, .12);
  border: 18px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
}

.hero-card .primary-button {
  position: relative;
  z-index: 1;
  color: var(--green-dark);
  background: #fff6cc;
  box-shadow: 0 12px 26px rgba(5, 48, 44, .24);
}

.hero-card .primary-button span {
  float: right;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.metric-card {
  min-width: 0;
  padding: 15px 12px;
  text-align: center;
  background: rgba(255, 255, 255, .76);
  border: 1px solid rgba(221, 231, 226, .82);
  border-radius: var(--radius-md);
  box-shadow: var(--soft-shadow);
}

.metric-card strong,
.metric-card small,
.metric-card .metric-icon {
  display: block;
}

.metric-card strong {
  margin: 4px 0 2px;
  color: var(--green-dark);
  font-size: 1.36rem;
}

.metric-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-icon {
  font-size: 1.1rem;
}

.content-card {
  padding: 20px;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(221, 231, 226, .82);
  border-radius: var(--radius-lg);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(12px);
}

.card-title-row,
.page-title-row {
  justify-content: space-between;
  gap: 14px;
}

.card-title-row h2,
.page-title-row h1 {
  margin-bottom: 0;
}

.page-title-row {
  margin: 6px 4px 3px;
}

.page-title-row .eyebrow {
  margin-left: 2px;
}

.bank-pill,
.small-badge,
.skill-pill {
  display: inline-flex;
  padding: 7px 10px;
  color: var(--green-dark);
  background: #e4f5ef;
  border: 1px solid #d3ece4;
}

.point-badge,
.combo-badge {
  padding: 8px 11px;
  color: #684900;
  background: #fff1bc;
  border: 1px solid #ffe28a;
}

.progress-track,
.session-progress,
.hp-track {
  overflow: hidden;
  height: 9px;
  margin: 16px 0 8px;
  background: #e8efeb;
  border-radius: 999px;
}

.progress-track span,
.session-progress span,
.hp-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--green));
  border-radius: inherit;
  transition: width .35s ease;
}

.progress-card h2 {
  font-size: 2rem;
}

.session-screen {
  min-height: calc(100vh - 140px);
}

.session-topbar {
  gap: 12px;
  padding: 0 3px;
}

.session-topbar .session-progress {
  flex: 1;
  margin: 0;
}

.session-count {
  min-width: 38px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 800;
  text-align: right;
}

.icon-button,
.sound-button,
.modal-close {
  display: grid;
  place-items: center;
  border: 0;
}

.icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: var(--muted);
  background: rgba(255, 255, 255, .84);
  border-radius: 13px;
  font-size: 1.5rem;
  line-height: 1;
}

.word-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  text-align: center;
  background: linear-gradient(165deg, #fff, #f5fbf8);
  border: 1px solid rgba(221, 231, 226, .92);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.word-card::before {
  position: absolute;
  width: 140px;
  height: 140px;
  top: -80px;
  right: -55px;
  content: "";
  background: rgba(98, 211, 180, .13);
  border-radius: 50%;
}

.word-card-top {
  position: relative;
  justify-content: space-between;
}

.sound-button {
  width: 42px;
  height: 42px;
  background: #edf7f3;
  border-radius: 14px;
}

.word-phonetic {
  margin-bottom: 4px;
  color: var(--muted);
  font-family: Georgia, serif;
}

.word-title {
  margin-bottom: 12px;
  color: var(--green-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.55rem, 13vw, 4.6rem);
  font-weight: 700;
  letter-spacing: -.055em;
}

.word-prompt {
  margin-bottom: 0;
  color: var(--muted);
}

.option-list {
  display: grid;
  gap: 10px;
}

.option-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  padding: 12px 14px;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(219, 230, 225, .95);
  border-radius: 17px;
  box-shadow: 0 5px 16px rgba(24, 68, 61, .05);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.option-button:not(.is-disabled):active {
  transform: scale(.987);
}

.option-letter {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--green);
  background: #e9f5f1;
  border-radius: 11px;
  font-size: .78rem;
  font-weight: 900;
}

.option-button.is-correct {
  color: #135b45;
  background: #ddf7eb;
  border-color: #91ddbd;
}

.option-button.is-correct .option-letter {
  color: #fff;
  background: #2ba978;
}

.option-button.is-wrong {
  color: #8c2934;
  background: #fde7e9;
  border-color: #efabb2;
}

.option-button.is-wrong .option-letter {
  color: #fff;
  background: var(--red);
}

.option-button.is-disabled {
  cursor: default;
}

.session-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: .83rem;
  text-align: center;
}

.feedback {
  display: flex;
  padding: 15px 16px;
  flex-direction: column;
  gap: 3px;
  border-radius: 16px;
}

.feedback span,
.feedback em {
  font-size: .87rem;
}

.feedback em {
  color: var(--muted);
  font-style: normal;
}

.feedback-correct {
  color: #176048;
  background: #e2f8ee;
  border: 1px solid #a9e5ca;
}

.feedback-wrong {
  color: #8d3140;
  background: #fdecef;
  border: 1px solid #f3bcc3;
}

.summary-hero {
  padding: 30px 24px;
  text-align: center;
  background: linear-gradient(150deg, #fff7d8, #ffffff 56%, #e1f7ef);
  border: 1px solid #e4eadc;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.summary-spark,
.result-emblem {
  display: grid;
  width: 66px;
  height: 66px;
  margin: 0 auto 16px;
  place-items: center;
  color: #775500;
  background: #ffe28d;
  border-radius: 24px;
  box-shadow: 0 10px 22px rgba(255, 196, 71, .25);
  font-size: 1.8rem;
}

.summary-metrics {
  display: flex;
  margin-top: 20px;
  justify-content: center;
  gap: 32px;
}

.summary-metrics span,
.summary-metrics strong {
  display: block;
}

.summary-metrics span {
  color: var(--muted);
  font-size: .75rem;
}

.summary-metrics strong {
  color: var(--green-dark);
  font-size: 1.25rem;
}

.word-review-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.word-review-list li {
  display: flex;
  padding: 10px 0;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid #edf2ef;
}

.word-review-list li:last-child {
  border-bottom: 0;
}

.word-review-list li > span {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--green);
  background: #ebf6f2;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 900;
}

.word-review-list div {
  min-width: 0;
  flex: 1;
}

.word-review-list strong,
.word-review-list small {
  display: block;
}

.word-review-list small {
  overflow: hidden;
  color: var(--muted);
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-review-list em {
  color: var(--green);
  font-size: .8rem;
  font-style: normal;
  font-weight: 900;
}

.section-heading {
  display: flex;
  margin: 5px 4px 0;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.active-partner-card,
.battle-guide {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 18px;
  padding: 18px;
  align-items: center;
  background: linear-gradient(145deg, #143f3b, #1e7569);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  color: #fff;
}

.active-partner-card .eyebrow,
.battle-guide .eyebrow {
  color: #bff9e7;
}

.active-partner-card p,
.battle-guide p {
  color: rgba(255, 255, 255, .76);
}

.active-partner-card h2,
.battle-guide h2 {
  margin-bottom: 6px;
}

.active-art,
.guide-hero {
  width: 112px;
  height: 112px;
}

.creature-art {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.creature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.creature-card {
  display: flex;
  min-width: 0;
  padding: 13px;
  flex-direction: column;
  background: rgba(255, 255, 255, .85);
  border: 1px solid rgba(221, 231, 226, .9);
  border-radius: var(--radius-lg);
  box-shadow: var(--soft-shadow);
}

.active-creature-card {
  border-color: #6fd1b5;
  box-shadow: 0 0 0 3px rgba(98, 211, 180, .16), var(--soft-shadow);
}

.creature-art-wrap {
  position: relative;
  height: 118px;
  padding: 5px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--creature-color) 18%, white), #fff);
  border-radius: 17px;
}

.owned-mark {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 7px;
  color: var(--green-dark);
  background: rgba(255, 255, 255, .84);
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 900;
  backdrop-filter: blur(8px);
}

.creature-info {
  min-height: 130px;
  padding-top: 13px;
}

.creature-info h3 {
  margin-bottom: 5px;
  font-size: 1.08rem;
}

.creature-info > p:last-child {
  color: var(--muted);
  font-size: .75rem;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 10px;
}

.stat-row span {
  padding: 7px 8px;
  color: var(--muted);
  background: #f3f7f5;
  border-radius: 11px;
  font-size: .7rem;
  text-align: center;
}

.stat-row strong {
  color: var(--ink);
}

.creature-button,
.level-button {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--green-dark);
  background: #e8f5f1;
  border: 1px solid #d3ebe3;
  font-size: .8rem;
}

.creature-button.is-active {
  color: #fff;
  background: var(--green);
}

.creature-button.cannot-buy,
.level-button:disabled {
  color: #8b9692;
  background: #edf1ef;
  border-color: #e1e8e4;
  opacity: .78;
}

.level-list {
  display: grid;
  gap: 11px;
}

.level-card {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 12px;
  padding: 13px;
  align-items: center;
  background: rgba(255, 255, 255, .86);
  border: 1px solid rgba(221, 231, 226, .92);
  border-radius: var(--radius-lg);
  box-shadow: var(--soft-shadow);
}

.level-card.is-current {
  border-color: #f1bd4f;
  box-shadow: 0 0 0 3px rgba(255, 200, 87, .16), var(--soft-shadow);
}

.level-card.is-locked {
  opacity: .58;
}

.level-monster {
  width: 76px;
  height: 76px;
  background: color-mix(in srgb, var(--monster-color) 13%, white);
  border-radius: 20px;
}

.level-copy {
  min-width: 0;
}

.level-copy h3 {
  margin-bottom: 3px;
}

.level-copy p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .7rem;
}

.level-card .level-button {
  width: 92px;
}

.arena-screen {
  position: relative;
}

.arena-topbar {
  justify-content: space-between;
  gap: 10px;
}

.arena-topbar div {
  text-align: center;
}

.arena-topbar p {
  margin-bottom: 0;
}

.arena-stage {
  position: relative;
  display: grid;
  min-height: 310px;
  padding: 18px 10px 6px;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 8px;
  background: linear-gradient(180deg, #dff3ec, #f7f4e7 70%);
  border: 1px solid #dce9e3;
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.arena-stage::before {
  position: absolute;
  width: 200%;
  height: 90px;
  left: -50%;
  bottom: -36px;
  content: "";
  background: rgba(72, 151, 124, .14);
  border-radius: 50%;
}

.fighter {
  position: relative;
  z-index: 1;
}

.fighter-art {
  width: 142px;
  max-width: 100%;
  height: 142px;
  margin: 0 auto;
  transition: transform .2s ease;
}

.monster-fighter .fighter-art {
  transform: translateY(-14px);
}

.hero-fighter .fighter-art {
  transform: translateY(0);
}

.fighter.is-hit .fighter-art {
  animation: fighterHit .42s ease;
}

.fighter-name {
  justify-content: space-between;
  gap: 6px;
  margin-top: 5px;
  font-size: .72rem;
}

.fighter-name span {
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fighter-name small {
  color: var(--muted);
  white-space: nowrap;
}

.hp-track {
  height: 8px;
  margin: 6px 0 0;
}

.monster-hp span {
  background: linear-gradient(90deg, #ee7a73, #c74455);
}

.hero-hp span {
  background: linear-gradient(90deg, #62d3b4, #1c8b72);
}

.battle-versus {
  position: absolute;
  z-index: 3;
  top: 142px;
  left: 50%;
  color: var(--green-dark);
  font-size: .72rem;
  font-weight: 1000;
  transform: translateX(-50%) rotate(-8deg);
}

.battle-versus::before,
.battle-versus::after {
  position: absolute;
  width: 42px;
  height: 1px;
  top: 50%;
  content: "";
  background: rgba(23, 107, 101, .24);
}

.battle-versus::before {
  right: calc(100% + 5px);
}

.battle-versus::after {
  left: calc(100% + 5px);
}

.battle-question-card {
  padding: 18px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(221, 231, 226, .9);
  border-radius: var(--radius-lg);
  box-shadow: var(--soft-shadow);
}

.battle-word-row {
  justify-content: space-between;
  gap: 12px;
}

.battle-word-row h2 {
  margin-bottom: 0;
  color: var(--green-dark);
  font-family: Georgia, serif;
  font-size: 2rem;
}

.battle-word-row .word-phonetic {
  margin-bottom: 0;
  font-size: .76rem;
}

.battle-message {
  margin: 12px 0;
  padding: 10px 12px;
  color: var(--green-dark);
  background: #edf7f3;
  border-radius: 12px;
  font-size: .8rem;
}

.compact-options .option-button {
  min-height: 48px;
  padding: 9px 11px;
  font-size: .82rem;
}

.battle-result-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(11, 37, 34, .56);
  backdrop-filter: blur(10px);
}

.battle-result-card {
  width: min(100%, 420px);
  padding: 28px 22px;
  text-align: center;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(5, 33, 29, .28);
  animation: resultIn .3s ease both;
}

.result-actions {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.profile-hero {
  display: flex;
  padding: 22px;
  align-items: center;
  gap: 15px;
  color: #fff;
  background: linear-gradient(140deg, #243f3b, #176b65);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.profile-hero .eyebrow {
  color: #bdf7e7;
}

.profile-hero h1 {
  margin-bottom: 3px;
  font-size: 1.65rem;
}

.profile-hero p:last-child {
  margin-bottom: 0;
  color: rgba(255, 255, 255, .72);
  font-size: .78rem;
}

.avatar-orb {
  display: grid;
  width: 70px;
  height: 70px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--green-dark);
  background: #fff2ba;
  border-radius: 24px;
  font-size: 1.7rem;
  font-weight: 900;
}

.profile-metrics .metric-card:nth-child(1) strong {
  color: #b17700;
}

.setting-block + .setting-block {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #edf2ef;
}

.setting-block label {
  display: block;
  margin-bottom: 10px;
  font-size: .82rem;
  font-weight: 900;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-chip {
  min-height: 40px;
  padding: 9px 12px;
  color: var(--muted);
  background: #f1f5f3;
  border: 1px solid #e0e8e4;
  border-radius: 13px;
  font-size: .77rem;
  font-weight: 800;
}

.choice-chip.is-selected {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.invite-card {
  display: grid;
  gap: 13px;
  background: linear-gradient(155deg, #fff9dd, #ffffff 65%);
}

.invite-card p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .85rem;
}

.invite-code {
  padding: 12px;
  color: #795700;
  background: #fff1b7;
  border: 1px dashed #e6bd45;
  border-radius: 14px;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: .18em;
  text-align: center;
}

.settings-row {
  display: flex;
  width: 100%;
  padding: 14px 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #edf2ef;
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row strong,
.settings-row small {
  display: block;
}

.settings-row small {
  color: var(--muted);
  font-size: .75rem;
}

.settings-row em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: .76rem;
  font-style: normal;
}

.danger-row strong {
  color: var(--red);
}

.app-version {
  margin: 4px 0 0;
  color: #9aa6a2;
  font-size: .72rem;
  text-align: center;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  width: min(calc(100% - 24px), 520px);
  padding: 8px;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(218, 230, 225, .94);
  border-radius: 22px;
  box-shadow: 0 16px 45px rgba(24, 68, 61, .16);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: grid;
  min-height: 55px;
  padding: 6px 4px;
  place-items: center;
  align-content: center;
  gap: 2px;
  color: #83918d;
  background: transparent;
  border: 0;
  border-radius: 16px;
  font-size: .69rem;
  font-weight: 850;
}

.nav-item.is-active {
  color: var(--green-dark);
  background: #e7f4ef;
}

.nav-icon {
  font-size: 1rem;
  font-weight: 1000;
}

.onboarding-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  padding: max(22px, env(safe-area-inset-top)) 16px max(30px, env(safe-area-inset-bottom));
  place-items: center;
  overflow: hidden;
}

.onboarding-glow {
  position: fixed;
  width: 360px;
  height: 360px;
  top: -160px;
  right: -130px;
  background: radial-gradient(circle, rgba(98, 211, 180, .42), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.onboarding-card {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  padding: 26px 20px;
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(219, 230, 225, .9);
  border-radius: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.onboarding-brand {
  text-align: center;
}

.onboarding-brand .brand-mark {
  margin: 0 auto 14px;
}

.onboarding-brand h1 {
  margin-bottom: 10px;
}

.onboarding-brand > p:last-child {
  color: var(--muted);
}

.onboarding-block {
  margin-top: 20px;
}

.onboarding-block > label {
  display: block;
  margin-bottom: 9px;
  font-size: .8rem;
  font-weight: 900;
}

.onboarding-bank-list {
  display: grid;
  gap: 9px;
}

.onboarding-bank {
  display: grid;
  width: 100%;
  padding: 12px;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-align: left;
  background: #f4f7f5;
  border: 1px solid #e3eae6;
  border-radius: 16px;
}

.onboarding-bank > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  background: var(--green);
  border-radius: 14px;
  font-weight: 900;
}

.onboarding-bank strong,
.onboarding-bank small {
  display: block;
}

.onboarding-bank small {
  color: var(--muted);
  font-size: .72rem;
}

.onboarding-bank em {
  color: var(--muted);
  font-size: .72rem;
  font-style: normal;
  font-weight: 900;
}

.onboarding-bank.is-selected {
  background: #e5f5ef;
  border-color: #8ed8c1;
  box-shadow: 0 0 0 3px rgba(98, 211, 180, .12);
}

.goal-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.goal-option {
  padding: 11px 6px;
  color: var(--ink);
  background: #f4f7f5;
  border: 1px solid #e3eae6;
  border-radius: 15px;
  font-size: 1.08rem;
  font-weight: 900;
}

.goal-option small {
  display: block;
  color: var(--muted);
  font-size: .67rem;
}

.goal-option.is-selected {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.goal-option.is-selected small {
  color: rgba(255, 255, 255, .74);
}

.name-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}

.name-input-row input {
  min-width: 0;
  padding: 12px 13px;
  color: var(--ink);
  background: #f8faf9;
  border: 1px solid #dbe6e1;
  border-radius: 15px;
}

.onboarding-footnote {
  margin: 18px 4px 0;
  color: var(--muted);
  font-size: .7rem;
  text-align: center;
}

.app-toast {
  position: fixed;
  z-index: 100;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 50%;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 11px 15px;
  color: #fff;
  background: rgba(17, 53, 49, .94);
  border-radius: 14px;
  box-shadow: 0 14px 35px rgba(7, 38, 34, .23);
  font-size: .82rem;
  font-weight: 800;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity .2s ease, transform .2s ease;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal-backdrop {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  padding: 18px;
  place-items: center;
  background: rgba(11, 37, 34, .5);
  backdrop-filter: blur(9px);
}

.modal-card {
  position: relative;
  width: min(100%, 460px);
  padding: 26px 22px 20px;
  background: #fff;
  border-radius: 26px;
  box-shadow: 0 30px 80px rgba(5, 33, 29, .28);
  animation: resultIn .25s ease both;
}

.modal-card h2 {
  padding-right: 30px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  color: var(--muted);
  background: #f1f5f3;
  border-radius: 12px;
  font-size: 1.3rem;
}

.modal-body {
  color: var(--muted);
  font-size: .88rem;
}

.modal-body ol {
  padding-left: 20px;
}

.modal-actions {
  display: flex;
  margin-top: 20px;
  justify-content: flex-end;
  gap: 8px;
}

.copy-link {
  overflow-wrap: anywhere;
  padding: 12px;
  color: var(--green-dark);
  background: #eef7f3;
  border-radius: 13px;
  font-size: .78rem;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes resultIn {
  from {
    opacity: 0;
    transform: scale(.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fighterHit {
  0%, 100% { transform: translateX(0); filter: none; }
  25% { transform: translateX(-8px) rotate(-3deg); filter: brightness(1.5); }
  55% { transform: translateX(7px) rotate(3deg); }
}

@media (min-width: 700px) {
  .app-main {
    padding-right: 24px;
    padding-left: 24px;
  }

  .study-home {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    align-items: start;
  }

  .study-hero {
    grid-row: span 2;
    min-height: 360px;
  }

  .study-home .metric-grid {
    grid-template-columns: 1fr;
  }

  .study-home .metric-card {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    text-align: left;
  }

  .study-home .metric-card strong {
    margin: 0;
    grid-column: 3;
    grid-row: 1;
  }

  .study-home .metric-card small {
    grid-column: 2;
    grid-row: 1;
  }

  .study-home .progress-card,
  .study-home > .subtle-note {
    grid-column: 2;
  }

  .creature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .creature-info {
    min-height: 142px;
  }

  .battle-question-card {
    padding: 22px;
  }
}

@media (max-width: 400px) {
  .header-stat:nth-child(1) {
    display: none;
  }

  .creature-grid {
    grid-template-columns: 1fr;
  }

  .creature-info {
    min-height: 0;
  }

  .active-partner-card,
  .battle-guide {
    grid-template-columns: 88px 1fr;
    gap: 12px;
  }

  .active-art,
  .guide-hero {
    width: 88px;
    height: 88px;
  }

  .level-card {
    grid-template-columns: 64px 1fr;
  }

  .level-monster {
    width: 64px;
    height: 64px;
  }

  .level-card .level-button {
    width: 100%;
    grid-column: 1 / -1;
  }

  .fighter-art {
    width: 116px;
    height: 116px;
  }
}

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


.battle-control-card,
.battle-log-card {
  padding: 18px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(221, 231, 226, .9);
  border-radius: var(--radius-lg);
  box-shadow: var(--soft-shadow);
}

.energy-row {
  display: flex;
  margin-bottom: 7px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: .76rem;
}

.energy-row strong {
  color: var(--green-dark);
}

.energy-track {
  overflow: hidden;
  height: 10px;
  margin-bottom: 15px;
  background: #e8efeb;
  border-radius: 999px;
}

.energy-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ffd66b, #ff8f5a);
  border-radius: inherit;
  transition: width .3s ease;
}

.battle-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.battle-action {
  display: grid;
  min-height: 100px;
  padding: 10px 7px;
  place-items: center;
  align-content: center;
  gap: 3px;
  color: var(--green-dark);
  background: #eef7f3;
  border: 1px solid #d9ebe5;
  border-radius: 17px;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.battle-action:active {
  transform: scale(.97);
}

.battle-action > span {
  font-size: 1.2rem;
}

.battle-action strong {
  font-size: .8rem;
}

.battle-action small {
  color: var(--muted);
  font-size: .62rem;
}

.defend-action {
  color: #355f8e;
  background: #edf3fc;
  border-color: #d9e5f5;
}

.skill-action {
  color: #805f12;
  background: #fff7df;
  border-color: #f1dfaa;
  opacity: .65;
}

.skill-action.is-ready {
  background: linear-gradient(145deg, #fff2bd, #ffe08b);
  border-color: #eec851;
  box-shadow: 0 8px 18px rgba(201, 147, 30, .16);
  opacity: 1;
}

.battle-log-card ul {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.battle-log-card li {
  padding: 8px 10px;
  color: var(--muted);
  background: #f6f8f7;
  border-radius: 10px;
  font-size: .74rem;
}

.battle-log-card li:first-child {
  color: var(--green-dark);
  background: #eaf6f1;
  font-weight: 800;
}

@media (max-width: 400px) {
  .battle-actions {
    grid-template-columns: 1fr;
  }

  .battle-action {
    min-height: 68px;
    grid-template-columns: 32px 1fr;
    grid-template-rows: auto auto;
    text-align: left;
  }

  .battle-action > span {
    grid-row: 1 / 3;
  }
}


.auth-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  padding: max(22px, env(safe-area-inset-top)) 16px max(30px, env(safe-area-inset-bottom));
  place-items: center;
  overflow: hidden;
}

.auth-glow {
  position: fixed;
  width: 420px;
  height: 420px;
  top: -190px;
  left: -160px;
  background: radial-gradient(circle, rgba(98, 211, 180, .5), transparent 70%);
  border-radius: 50%;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  padding: 28px 22px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(219, 230, 225, .92);
  border-radius: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.auth-tabs {
  display: grid;
  margin: 22px 0 18px;
  padding: 5px;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  background: #eef4f1;
  border-radius: 15px;
}

.auth-tabs button {
  min-height: 42px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 12px;
  font-weight: 900;
}

.auth-tabs button.is-active {
  color: var(--green-dark);
  background: #fff;
  box-shadow: 0 5px 14px rgba(24, 68, 61, .08);
}

.auth-form {
  display: grid;
  gap: 13px;
}

.auth-form label,
.coop-actions label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 900;
}

.auth-form input,
.coop-create-row select,
.coop-actions select {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  color: var(--ink);
  background: #f8faf9;
  border: 1px solid #dbe6e1;
  border-radius: 14px;
}

.auth-features {
  display: flex;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.auth-features span,
.hidden-combo,
.team-chip {
  padding: 6px 9px;
  color: var(--green-dark);
  background: #e7f5ef;
  border: 1px solid #d4ece4;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 900;
}

.affinity-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  padding: 18px;
  align-items: center;
  color: #fff;
  background: linear-gradient(145deg, #213d39, #176b65);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.affinity-card > span {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 22px;
  font-size: 1.8rem;
}

.affinity-card .eyebrow {
  color: #bdf7e7;
}

.affinity-card p:last-child {
  margin-bottom: 0;
  color: rgba(255, 255, 255, .72);
  font-size: .8rem;
}

.team-slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.team-slot {
  display: grid;
  min-width: 0;
  padding: 9px 6px;
  place-items: center;
  text-align: center;
  background: #f3f8f5;
  border: 1px solid #e0ebe6;
  border-radius: 16px;
}

.team-slot.empty {
  min-height: 105px;
  color: #9aa8a3;
}

.team-slot.empty span {
  font-size: 1.5rem;
}

.team-slot strong {
  overflow: hidden;
  width: 100%;
  font-size: .65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-slot small {
  color: var(--muted);
  font-size: .6rem;
}

.team-mini-art {
  width: 58px;
  height: 58px;
}

.team-chip-row {
  display: flex;
  margin: 13px 0;
  flex-wrap: wrap;
  gap: 7px;
}

.team-chip {
  display: inline-flex;
  padding: 3px 8px 3px 3px;
  align-items: center;
  gap: 5px;
}

.team-chip .creature-art {
  width: 30px;
  height: 30px;
}

.team-chip strong {
  font-size: .68rem;
}

.team-chip small {
  font-size: .7rem;
}

.catalog-note,
.warning-card {
  margin: 0 4px;
  color: var(--muted);
  font-size: .76rem;
}

.warning-card {
  padding: 18px;
  color: #6f4c00;
  background: #fff5d7;
  border: 1px solid #efd99b;
  border-radius: var(--radius-lg);
}

.warning-card p {
  margin: 4px 0 12px;
  font-size: .8rem;
}

.tier-section {
  display: grid;
  gap: 12px;
}

.cost-line {
  display: flex;
  margin-bottom: 9px;
  justify-content: space-between;
  gap: 8px;
  color: var(--green-dark);
  font-size: .68rem;
}

.cost-line em {
  color: var(--muted);
  font-style: normal;
}

.stat-row {
  grid-template-columns: repeat(3, 1fr);
}

.coop-create-card {
  display: grid;
  gap: 14px;
  background: linear-gradient(150deg, #eef8f4, #fff);
}

.coop-create-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.coop-room-list,
.coop-members {
  display: grid;
  gap: 10px;
}

.coop-room-row,
.coop-member {
  display: flex;
  padding: 14px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, .86);
  border: 1px solid rgba(221, 231, 226, .92);
  border-radius: 18px;
  box-shadow: var(--soft-shadow);
}

.coop-room-row h3,
.coop-member strong {
  margin-bottom: 2px;
}

.coop-room-row p,
.coop-member small {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .72rem;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, .7);
  border: 1px dashed #cfddd7;
  border-radius: var(--radius-lg);
}

.empty-state span {
  font-size: 2rem;
}

.coop-member {
  justify-content: flex-start;
}

.coop-member > div {
  min-width: 0;
  flex: 1;
}

.coop-member em {
  color: var(--muted);
  font-size: .72rem;
  font-style: normal;
  font-weight: 900;
}

.coop-member.is-ready em {
  color: var(--green);
}

.member-avatar {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  background: #edf7f3;
  border-radius: 16px;
}

.coop-actions {
  display: grid;
  gap: 11px;
}

.environment-preview {
  display: grid;
  padding: 18px;
  grid-template-columns: 64px 1fr;
  gap: 13px;
  align-items: center;
  color: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.environment-preview > span {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  background: rgba(255, 255, 255, .18);
  border-radius: 22px;
  font-size: 1.8rem;
}

.environment-preview p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, .75);
  font-size: .8rem;
}

.environment-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  background: rgba(255, 255, 255, .58);
  border-radius: 18px;
  font-size: 1.4rem;
}

.environment-card {
  position: relative;
  overflow: hidden;
}

.environment-card::before,
.auto-arena-screen::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  opacity: .2;
}

.env-grassland,
.env-grassland::before { background: linear-gradient(145deg, #dff4cf, #f7f8e5); }
.env-lakeside,
.env-lakeside::before { background: linear-gradient(145deg, #d8f2fb, #eaf8f4); }
.env-desert,
.env-desert::before { background: linear-gradient(145deg, #f8e8bd, #f7c98c); }
.env-volcano,
.env-volcano::before { background: linear-gradient(145deg, #3f2728, #d15c45); }
.env-glacier,
.env-glacier::before { background: linear-gradient(145deg, #dff7ff, #a3d9ee); }
.env-canyon,
.env-canyon::before { background: linear-gradient(145deg, #e8d4bd, #bd9676); }
.env-forest,
.env-forest::before { background: linear-gradient(145deg, #cbe7b8, #5b9d68); }
.env-ruins,
.env-ruins::before { background: linear-gradient(145deg, #d8d4e5, #746e91); }
.env-stormfield,
.env-stormfield::before { background: linear-gradient(145deg, #cad7e8, #596a8d); }
.env-coast,
.env-coast::before { background: linear-gradient(145deg, #d4f4ef, #65b7c7); }
.env-crystal,
.env-crystal::before { background: linear-gradient(145deg, #d9f7ff, #8798d3); }
.env-void,
.env-void::before { background: linear-gradient(145deg, #29253d, #5d3e78); }

.auto-arena-screen {
  position: relative;
  overflow: hidden;
}

.auto-arena-screen > * {
  position: relative;
  z-index: 1;
}

.speed-button {
  min-width: 48px;
  padding: 8px 10px;
  color: #fff;
  background: var(--green);
  border: 0;
  border-radius: 13px;
  font-weight: 900;
}

.auto-battle-stage {
  display: grid;
  min-height: 360px;
  padding: 16px;
  align-items: start;
  gap: 14px;
  background: rgba(255, 255, 255, .38);
  border: 1px solid rgba(255, 255, 255, .56);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(7px);
}

.auto-monster {
  display: grid;
  justify-items: center;
}

.auto-monster .fighter-name {
  width: min(100%, 300px);
}

.auto-monster-art {
  width: 180px;
  height: 180px;
}

.auto-monster.is-hit .auto-monster-art,
.auto-unit.is-acting .auto-unit-art {
  animation: fighterHit .42s ease;
}

.auto-team-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.auto-unit {
  display: grid;
  padding: 9px;
  grid-template-columns: 62px 1fr;
  gap: 7px;
  align-items: center;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(255, 255, 255, .76);
  border-radius: 16px;
}

.auto-unit.is-down {
  filter: grayscale(1);
  opacity: .45;
}

.auto-unit-art {
  width: 62px;
  height: 62px;
}

.auto-unit-info {
  min-width: 0;
}

.auto-unit-info strong,
.auto-unit-info small,
.auto-unit-info em {
  display: block;
}

.auto-unit-info strong {
  overflow: hidden;
  font-size: .76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auto-unit-info small,
.auto-unit-info em {
  color: var(--muted);
  font-size: .61rem;
  font-style: normal;
}

.auto-log-card {
  padding: 18px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(221, 231, 226, .9);
  border-radius: var(--radius-lg);
  box-shadow: var(--soft-shadow);
}

.auto-log-card h3 {
  min-height: 2.6em;
  margin-bottom: 13px;
}

.log-progress {
  overflow: hidden;
  height: 5px;
  margin-bottom: 12px;
  background: #e7efeb;
  border-radius: 999px;
}

.log-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--green));
  transition: width .25s ease;
}

.hidden-combos {
  display: flex;
  min-height: 32px;
  margin-bottom: 13px;
  flex-wrap: wrap;
  gap: 6px;
}

.viewer-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

@media (min-width: 700px) {
  .auto-battle-stage {
    grid-template-columns: 220px 1fr;
    align-items: center;
  }

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

@media (max-width: 430px) {
  .team-slots {
    grid-template-columns: repeat(2, 1fr);
  }

  .coop-create-row {
    grid-template-columns: 1fr;
  }

  .auto-unit {
    grid-template-columns: 50px 1fr;
  }

  .auto-unit-art {
    width: 50px;
    height: 50px;
  }
}


.env-random,
.env-random::before {
  background: linear-gradient(145deg, #dff4e7, #f6e6c5);
}

.auto-battle-stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.nature-backdrop {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}

.nature-backdrop svg {
  display: block;
  width: 100%;
  height: 100%;
}

.nature-backdrop::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .3));
  pointer-events: none;
}

.auto-battle-stage > .auto-monster,
.auto-battle-stage > .auto-team-grid {
  position: relative;
  z-index: 1;
}

.environment-effect {
  padding: 6px 9px;
  color: #31534d;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 900;
}

.environment-effect.team {
  color: #166346;
  background: #dff8ec;
}

.environment-effect.monster {
  color: #8b3040;
  background: #fde6ea;
}

.environment-effect.balanced {
  color: #6a5420;
  background: #fff2c9;
}


.battle-3d-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: clamp(360px, 58vh, 520px);
  background: #91cfee;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.battle-3d-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.battle-3d-hud {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  padding: 10px;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
  background: linear-gradient(180deg, rgba(10, 27, 27, 0), rgba(10, 27, 27, .74));
  pointer-events: none;
}

.hud-monster {
  min-width: 0;
  padding: 8px 10px;
  color: #fff;
  background: rgba(23, 29, 42, .62);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 13px;
  backdrop-filter: blur(8px);
}

.hud-monster strong,
.hud-monster small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-monster strong {
  font-size: .76rem;
}

.hud-monster small {
  color: rgba(255, 255, 255, .72);
  font-size: .62rem;
}

.hud-monster .hp-track {
  margin: 6px 0 0;
}

.hud-team {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.hud-team .auto-unit {
  min-width: 0;
  padding: 5px 7px;
  grid-template-columns: 38px 1fr;
  gap: 5px;
  color: #fff;
  background: rgba(23, 29, 42, .62);
  border-color: rgba(255, 255, 255, .16);
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

.hud-team .auto-unit-art {
  width: 38px;
  height: 38px;
}

.hud-team .auto-unit-info strong {
  color: #fff;
}

.hud-team .auto-unit-info small,
.hud-team .auto-unit-info em {
  color: rgba(255, 255, 255, .68);
}

.hud-team .hp-track {
  height: 5px;
  margin: 3px 0;
}

@media (max-width: 430px) {
  .battle-3d-stage {
    height: 62vh;
    min-height: 390px;
  }

  .battle-3d-hud {
    grid-template-columns: 1fr;
  }

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


.bottom-nav {
  grid-template-columns: repeat(5, 1fr);
}

.friend-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  padding: 24px;
  grid-template-columns: 1fr 78px;
  gap: 15px;
  color: #fff;
  background: linear-gradient(145deg, #183f3b, #238b78);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.friend-hero .eyebrow {
  color: #bdf7e7;
}

.friend-hero p:not(.eyebrow) {
  color: rgba(255, 255, 255, .75);
  font-size: .82rem;
}

.friend-hero-icon {
  display: grid;
  width: 78px;
  height: 78px;
  place-items: center;
  align-self: center;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 26px;
  font-size: 2rem;
}

.friend-add-row {
  display: grid;
  margin-top: 14px;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.friend-add-row input {
  min-width: 0;
  min-height: 48px;
  padding: 11px 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, .94);
  border: 0;
  border-radius: 14px;
}

.friend-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.friend-card {
  display: grid;
  padding: 13px;
  grid-template-columns: 52px 1fr auto;
  gap: 11px;
  align-items: center;
  background: #f8faf9;
  border: 1px solid #e2ebe7;
  border-radius: 17px;
}

.friend-avatar {
  position: relative;
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: var(--green-dark);
  background: #dff3eb;
  border-radius: 17px;
  font-size: 1.15rem;
  font-weight: 900;
}

.friend-avatar span {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 11px;
  height: 11px;
  background: #b1bcb8;
  border: 2px solid #fff;
  border-radius: 50%;
}

.friend-avatar.is-online span {
  background: #2ccb7e;
}

.friend-main {
  min-width: 0;
}

.friend-name-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.friend-name-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-name-row small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: .68rem;
}

.friend-main p {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-actions {
  display: grid;
  gap: 5px;
  justify-items: end;
}

.friend-action {
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  font-size: .68rem;
  font-weight: 900;
}

.friend-action.primary {
  color: #fff;
  background: var(--green);
}

.friend-action.subtle {
  color: var(--muted);
  background: #edf2ef;
}

.request-state {
  color: var(--muted);
  font-size: .68rem;
  white-space: nowrap;
}

@media (max-width: 460px) {
  .friend-hero {
    grid-template-columns: 1fr;
  }

  .friend-hero-icon {
    position: absolute;
    right: -12px;
    bottom: -12px;
    opacity: .22;
  }

  .friend-add-row {
    grid-template-columns: 1fr;
  }

  .friend-card {
    grid-template-columns: 46px 1fr;
  }

  .friend-avatar {
    width: 46px;
    height: 46px;
  }

  .friend-actions {
    width: 100%;
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  .friend-action {
    width: 100%;
  }

  .request-state {
    grid-column: 1 / -1;
    text-align: right;
  }
}


.auth-install-button {
  margin-top: 14px;
}
