:root {
  --bg-0: #040a12;
  --bg-1: #0b1b2c;
  --bg-2: #12304b;
  --panel: rgba(10, 24, 40, 0.8);
  --line: rgba(140, 209, 204, 0.28);
  --line-strong: rgba(214, 190, 121, 0.42);
  --accent: #7ee4d8;
  --accent-2: #dcbf79;
  --text: #eaf6f7;
  --muted: #a9c0c9;
  --danger: #d06d6d;
  --ok: #79c282;
  --glow-cyan: rgba(126, 228, 216, 0.33);
  --glow-gold: rgba(220, 191, 121, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  color: var(--text);
  background: radial-gradient(circle at 16% -8%, #1f4569, var(--bg-0) 52%),
    radial-gradient(circle at 86% 4%, rgba(85, 123, 164, 0.24), transparent 38%),
    linear-gradient(130deg, #040a12, #08182a 42%, #050d18 100%);
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("assets/ink-clouds.svg"), linear-gradient(140deg, rgba(120, 196, 188, 0.08), rgba(28, 45, 69, 0.06)),
    radial-gradient(circle at 80% 10%, rgba(215, 193, 127, 0.12), transparent 40%);
  background-size: cover, auto, auto;
  background-position: center top, center, center;
  opacity: 0.92;
  filter: saturate(1.08) contrast(1.06);
  animation: mistDrift 36s linear infinite alternate;
}

@keyframes mistDrift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-12px);
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(160deg, rgba(8, 18, 32, 0.92), rgba(7, 17, 29, 0.84));
  border-bottom: 1px solid var(--line-strong);
  backdrop-filter: blur(9px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.branding {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.gear-menu-wrap {
  position: relative;
}

.gear-menu-btn {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(214, 190, 121, 0.56);
  background: linear-gradient(165deg, rgba(35, 63, 90, 0.94), rgba(16, 31, 47, 0.96));
  color: #f2f6f8;
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 700;
  padding: 0;
}

.gear-menu-btn.fab-active {
  border-color: rgba(126, 228, 216, 0.78);
  box-shadow: 0 0 0.95rem rgba(126, 228, 216, 0.38);
}

.gear-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  width: 168px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.36rem;
  padding: 0.44rem;
  border: 1px solid rgba(126, 228, 216, 0.36);
  border-radius: 12px;
  background: linear-gradient(170deg, rgba(9, 24, 39, 0.96), rgba(8, 19, 31, 0.96));
  box-shadow: 0 0.9rem 1.7rem rgba(0, 0, 0, 0.46);
  z-index: 82;
}

.gear-menu-dropdown .menu-orb {
  min-height: 40px;
}

.emblem {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid rgba(220, 191, 121, 0.45);
  box-shadow: 0 0 0.7rem rgba(126, 228, 216, 0.22);
}

h1 {
  margin: 0;
  font-size: clamp(1.16rem, 2.2vw, 1.56rem);
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.top-actions button {
  min-height: 36px;
  padding-inline: 0.7rem;
}

.save-status {
  align-self: center;
  font-size: 0.75rem;
  color: #c4dce4;
  border: 1px solid rgba(140, 204, 196, 0.28);
  border-radius: 999px;
  padding: 0.26rem 0.55rem;
  background: linear-gradient(165deg, rgba(15, 34, 53, 0.78), rgba(11, 25, 40, 0.62));
}

.resource-strip {
  position: sticky;
  top: 74px;
  z-index: 18;
  margin: 0.4rem auto 0;
  width: min(1320px, calc(100% - 1.2rem));
  padding: 0.42rem;
  border: 1px solid rgba(147, 191, 208, 0.28);
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(10, 27, 42, 0.9), rgba(8, 20, 33, 0.8));
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(108px, 1fr);
  gap: 0.4rem;
  overflow-x: auto;
}

.resource-chip {
  border: 1px solid rgba(149, 192, 207, 0.26);
  background: linear-gradient(165deg, rgba(16, 35, 55, 0.8), rgba(12, 26, 42, 0.58));
  border-radius: 10px;
  padding: 0.32rem 0.45rem;
  box-shadow: inset 0 0 0.35rem rgba(7, 18, 29, 0.32);
}

.resource-chip span {
  display: block;
  color: #a8bec8;
  font-size: 0.68rem;
  line-height: 1.1;
}

.resource-chip strong {
  display: block;
  margin-top: 0.16rem;
  color: #e7f5f6;
  font-size: 0.8rem;
  line-height: 1.15;
  font-weight: 700;
}

.layout {
  width: 100%;
  max-width: 1320px;
  min-height: calc(100vh - 162px);
  margin: 0 auto;
  padding: 1rem 1rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(170deg, rgba(12, 29, 47, 0.86), rgba(8, 21, 37, 0.8));
  border-radius: 15px;
  padding: 0.95rem;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, rgba(220, 191, 121, 0.08), transparent 32%);
  mix-blend-mode: screen;
}

.hero-panel {
  width: min(760px, 96vw);
  margin: 0 auto;
  text-align: center;
}

.hero-stage {
  width: min(760px, 96vw);
  margin: 0 auto;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.hero-stage::before {
  display: none;
}

.stats-panel {
  grid-column: span 3;
}

.systems-panel {
  grid-column: span 3;
}

.event-panel {
  grid-column: span 2;
}

h2,
h3,
h4 {
  margin-top: 0;
  color: var(--accent-2);
  letter-spacing: 0.015em;
}

.hero-art-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(139, 224, 223, 0.28);
  margin-bottom: 0.7rem;
  box-shadow: inset 0 0 2.6rem rgba(7, 16, 27, 0.35);
}

.hero-art {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  filter: saturate(1.18) contrast(1.08) brightness(1.05);
}

.hero-seal {
  position: absolute;
  right: 0.6rem;
  bottom: 0.45rem;
  width: 62px;
  height: 62px;
  opacity: 0.88;
  filter: drop-shadow(0 0 0.5rem rgba(126, 228, 216, 0.32));
  animation: heroSealFloat 7.8s ease-in-out infinite;
}

@keyframes heroSealFloat {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-4px) rotate(2deg);
  }
}

button {
  appearance: none;
  border: 1px solid rgba(185, 223, 214, 0.38);
  background: linear-gradient(160deg, rgba(38, 73, 101, 0.85), rgba(16, 34, 56, 0.92));
  color: var(--text);
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 0.4rem 0.8rem rgba(13, 27, 44, 0.44), 0 0 0.6rem var(--glow-cyan);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

button:focus-visible {
  outline: 2px solid rgba(220, 191, 121, 0.85);
  outline-offset: 1px;
}

.primary {
  width: 100%;
  background: linear-gradient(160deg, rgba(53, 118, 126, 0.94), rgba(24, 61, 73, 0.95));
  border-color: rgba(145, 219, 211, 0.58);
  box-shadow: inset 0 0 0.2rem rgba(255, 255, 255, 0.22), 0 0 0.9rem rgba(110, 214, 203, 0.18);
}

.massive {
  padding: 0.95rem;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

#gather-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

#gather-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, rgba(255, 237, 186, 0.22), rgba(255, 220, 125, 0.08) 38%, transparent 72%);
  pointer-events: none;
  z-index: 0;
}

#gather-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 84%;
  height: 84%;
  border-radius: 50%;
  border: 2px solid rgba(245, 216, 139, 0.9);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.65);
  pointer-events: none;
  z-index: 0;
}

#gather-btn.gather-pulse::after {
  animation: gatherHalo 0.34s ease-out;
}

#gather-btn.gather-pulse::before {
  animation: gatherFlash 0.24s ease-out;
}

#gather-btn.gather-pulse .gong-center {
  animation: gongCoreThump 0.22s ease-out;
}

#gather-btn:focus {
  outline: none;
}

.gong-button {
  width: 220px;
  height: 220px;
  margin: 0.35rem auto 0.45rem;
  border-radius: 50%;
  border: 3px solid rgba(214, 190, 121, 0.72);
  background: radial-gradient(circle at 34% 32%, rgba(240, 216, 148, 0.96), rgba(167, 118, 48, 0.92) 62%, rgba(102, 63, 24, 0.95) 100%);
  box-shadow: inset 0 0 0.65rem rgba(255, 243, 212, 0.58), inset 0 -0.9rem 1rem rgba(68, 34, 12, 0.35), 0 0 1.6rem rgba(220, 191, 121, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transform-origin: center center;
}

.gong-button:hover {
  transform: translateY(-1px) scale(1.008);
  box-shadow: inset 0 0 0.7rem rgba(255, 243, 212, 0.62), inset 0 -0.9rem 1rem rgba(68, 34, 12, 0.38), 0 0 2rem rgba(220, 191, 121, 0.42);
}

.gong-button:active {
  transform: scale(0.985);
}

.gong-center {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(99, 53, 22, 0.88);
  background: radial-gradient(circle at 40% 34%, rgba(139, 76, 31, 0.94), rgba(92, 45, 17, 0.98));
  box-shadow: inset 0 0 0.24rem rgba(255, 212, 145, 0.34);
}

.gong-label {
  position: relative;
  z-index: 1;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #3f1f0c;
  text-shadow: 0 1px 0 rgba(255, 230, 188, 0.5);
}

.gong-halo {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.gong-wave {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(244, 216, 141, 0.78);
  transform: translate(-50%, -50%) scale(0.22);
  opacity: 0.76;
  pointer-events: none;
  z-index: 0;
  animation: gongWaveExpand 0.72s ease-out forwards;
}

.ring-menu {
  display: none;
}

.menu-orb {
  width: 100%;
  min-height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(148, 201, 221, 0.48);
  background: linear-gradient(165deg, rgba(28, 62, 90, 0.95), rgba(14, 33, 52, 0.94));
  color: #e5f4f8;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.menu-orb.fab-active {
  border-color: rgba(126, 228, 216, 0.78);
  box-shadow: 0 0.8rem 1.4rem rgba(0, 0, 0, 0.36), 0 0 0.85rem rgba(126, 228, 216, 0.34);
}

.menu-orb.menu-orb-locked {
  opacity: 0.48;
  border-color: rgba(170, 180, 190, 0.34);
  filter: grayscale(0.22);
}

.objective-card {
  width: min(560px, 92vw);
  margin: 0.15rem auto 0.6rem;
  border: 1px solid rgba(126, 228, 216, 0.32);
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(16, 38, 58, 0.82), rgba(10, 25, 41, 0.65));
  padding: 0.62rem 0.7rem;
  text-align: left;
}

.objective-card p {
  margin: 0.16rem 0;
  font-size: 0.84rem;
  color: #d4e6eb;
}

#objective-title {
  color: #f1dfaa;
  font-weight: 700;
}

#objective-unlock {
  color: #b8d5de;
}

@keyframes gatherHalo {
  0% {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(0.65);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.18);
  }
}

@keyframes gatherFlash {
  0% {
    opacity: 0.15;
  }
  50% {
    opacity: 0.45;
  }
  100% {
    opacity: 0.15;
  }
}

@keyframes gongCoreThump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes gongWaveExpand {
  0% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(0.22);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(4.1);
  }
}

.secondary {
  width: 100%;
  margin-top: 0.45rem;
}

.ghost {
  background: linear-gradient(160deg, rgba(27, 54, 78, 0.5), rgba(13, 28, 45, 0.58));
}

.danger {
  border-color: rgba(208, 109, 109, 0.6);
  background: linear-gradient(160deg, rgba(88, 38, 44, 0.78), rgba(56, 25, 30, 0.84));
}

.core-actions {
  margin: 0.5rem 0;
  width: min(420px, 92vw);
  margin-inline: auto;
}

.milestone {
  margin-top: 0.8rem;
  border: 1px solid rgba(121, 194, 130, 0.42);
  border-radius: 12px;
  padding: 0.7rem;
  background: linear-gradient(165deg, rgba(20, 50, 37, 0.68), rgba(14, 35, 27, 0.46));
  text-align: left;
}

.milestone h3 {
  margin-bottom: 0.3rem;
}

.milestone p {
  margin: 0 0 0.5rem;
  color: #c4ddc8;
}

.quest-box {
  border: 1px solid rgba(110, 214, 203, 0.36);
  background: linear-gradient(165deg, rgba(17, 44, 62, 0.72), rgba(11, 32, 49, 0.56));
  border-radius: 12px;
  padding: 0.58rem;
}

.quest-box p {
  margin: 0.2rem 0 0.45rem;
  color: #d2e4e8;
  font-size: 0.84rem;
}

.mission-box {
  border-color: rgba(215, 193, 127, 0.36);
  background: linear-gradient(165deg, rgba(52, 39, 20, 0.67), rgba(33, 28, 16, 0.5));
}

#quest-title {
  color: #efdca0;
  font-weight: 700;
}

#quest-reward {
  margin-bottom: 0;
  color: #b7d4bf;
}

#mission-title {
  color: #f3e5b6;
  font-weight: 700;
}

#mission-reward {
  margin-bottom: 0;
  color: #d7d0b1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}

.stats-grid div {
  border: 1px solid rgba(138, 194, 206, 0.18);
  background: linear-gradient(165deg, rgba(20, 37, 57, 0.74), rgba(14, 28, 45, 0.58));
  border-radius: 10px;
  padding: 0.45rem;
  box-shadow: inset 0 0 0.35rem rgba(6, 16, 26, 0.36);
}

.stats-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.stats-grid strong {
  font-size: 1rem;
}

.upgrades {
  display: grid;
  gap: 0.6rem;
}

.talents {
  display: grid;
  gap: 0.55rem;
}

.recipes {
  display: grid;
  gap: 0.55rem;
}

.expeditions {
  display: grid;
  gap: 0.55rem;
}

.expedition-choice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.expedition-choice-actions .secondary {
  margin-top: 0;
}

.upgrade-card {
  border: 1px solid rgba(126, 199, 189, 0.25);
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(15, 33, 50, 0.82), rgba(11, 27, 42, 0.62));
  padding: 0.6rem;
}

.recipe-card {
  border: 1px solid rgba(196, 179, 115, 0.32);
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(34, 40, 44, 0.78), rgba(24, 28, 35, 0.6));
  padding: 0.6rem;
}

.talent-card {
  border: 1px solid rgba(142, 193, 235, 0.36);
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(19, 33, 52, 0.82), rgba(13, 27, 44, 0.62));
  padding: 0.6rem;
}

.expedition-card {
  border: 1px solid rgba(154, 214, 196, 0.34);
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(16, 36, 48, 0.85), rgba(11, 29, 38, 0.62));
  padding: 0.6rem;
}

.upgrade-card,
.recipe-card,
.talent-card,
.expedition-card,
.sub-panel,
.event-card {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.upgrade-card:hover,
.recipe-card:hover,
.talent-card:hover,
.expedition-card:hover,
.sub-panel:hover,
.event-card:hover {
  border-color: rgba(220, 191, 121, 0.5);
  box-shadow: 0 0.7rem 1.4rem rgba(6, 18, 30, 0.38);
  transform: translateY(-1px);
}

.upgrade-card h4 {
  margin: 0;
  font-size: 1rem;
}

.recipe-card h4 {
  margin: 0;
  font-size: 0.96rem;
}

.talent-card h4 {
  margin: 0;
  font-size: 0.96rem;
}

.expedition-card h4 {
  margin: 0;
  font-size: 0.96rem;
}

.upgrade-card p {
  margin: 0.3rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.recipe-card p {
  margin: 0.32rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.talent-card p {
  margin: 0.32rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.expedition-card p {
  margin: 0.32rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.84rem;
}

#talent-respec-btn {
  margin-top: 0.5rem;
}

.upgrade-meta {
  margin-top: 0.35rem;
  color: #c3dbe2;
  font-size: 0.82rem;
}

.recipe-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.recipe-meta {
  margin-top: 0.35rem;
  color: #ccd8cb;
  font-size: 0.81rem;
}

.sub-panel {
  border: 1px solid rgba(126, 199, 189, 0.25);
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(13, 30, 47, 0.84), rgba(10, 24, 39, 0.64));
  padding: 0.6rem;
  margin-bottom: 0.6rem;
  position: relative;
  overflow: hidden;
}

.sub-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(125deg, rgba(126, 228, 216, 0.06), transparent 38%);
}

.sub-panel h3 {
  margin-bottom: 0.35rem;
}

.sub-panel p {
  margin: 0.35rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.85rem;
}

#expedition-panel {
  background-image: linear-gradient(165deg, rgba(13, 31, 47, 0.88), rgba(10, 24, 39, 0.7)), url("assets/expedition-map.svg");
  background-size: auto, cover;
  background-position: center, center;
  background-repeat: no-repeat;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

#expedition-panel.choice-flash-a {
  animation: expeditionChoiceFlashA 0.34s ease-out;
}

#expedition-panel.choice-flash-b {
  animation: expeditionChoiceFlashB 0.34s ease-out;
}

#expedition-panel.choice-flash-chain {
  animation: expeditionChoiceFlashChain 0.34s ease-out;
}

@keyframes expeditionChoiceFlashA {
  0% {
    box-shadow: 0 0 0 rgba(110, 214, 203, 0);
    border-color: rgba(126, 199, 189, 0.25);
  }
  42% {
    box-shadow: 0 0 0.9rem rgba(110, 214, 203, 0.34);
    border-color: rgba(132, 230, 219, 0.8);
  }
  100% {
    box-shadow: 0 0 0 rgba(110, 214, 203, 0);
    border-color: rgba(126, 199, 189, 0.25);
  }
}

@keyframes expeditionChoiceFlashB {
  0% {
    box-shadow: 0 0 0 rgba(215, 193, 127, 0);
    border-color: rgba(126, 199, 189, 0.25);
  }
  42% {
    box-shadow: 0 0 0.9rem rgba(215, 193, 127, 0.32);
    border-color: rgba(239, 214, 147, 0.82);
  }
  100% {
    box-shadow: 0 0 0 rgba(215, 193, 127, 0);
    border-color: rgba(126, 199, 189, 0.25);
  }
}

@keyframes expeditionChoiceFlashChain {
  0% {
    box-shadow: 0 0 0 rgba(150, 192, 255, 0);
    border-color: rgba(126, 199, 189, 0.25);
  }
  42% {
    box-shadow: 0 0 1rem rgba(141, 182, 246, 0.35);
    border-color: rgba(141, 182, 246, 0.82);
  }
  100% {
    box-shadow: 0 0 0 rgba(150, 192, 255, 0);
    border-color: rgba(126, 199, 189, 0.25);
  }
}

.settings-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.38rem;
}

.settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.38rem;
  margin-bottom: 0.55rem;
}

.settings-actions .ghost,
.settings-actions .danger {
  margin-top: 0;
}

.settings-row .secondary {
  margin-top: 0;
}

.codex-list {
  margin: 0.2rem 0 0;
  padding-left: 1rem;
  color: #c9dce3;
  font-size: 0.82rem;
}

.codex-list li {
  margin-bottom: 0.3rem;
}

.relic-list {
  margin: 0.2rem 0 0.5rem;
  padding-left: 1rem;
  color: #d8d1b6;
  font-size: 0.82rem;
}

.relic-list li {
  margin-bottom: 0.3rem;
}

.relic-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
}

.relic-options .secondary {
  margin-top: 0;
}

.relic-option-btn {
  border-color: rgba(215, 193, 127, 0.5);
  background: linear-gradient(160deg, rgba(66, 56, 30, 0.84), rgba(32, 30, 24, 0.92));
}

.dao-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
}

.dao-buttons .secondary {
  margin-top: 0;
}

.dao-cta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-align: left;
  padding: 0.48rem 0.6rem;
}

.dao-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(215, 193, 127, 0.32);
  background: rgba(5, 16, 27, 0.42);
  flex-shrink: 0;
}

.dao-cta span {
  display: inline-block;
  line-height: 1.2;
}

.dao-selected {
  border-color: rgba(220, 191, 121, 0.74) !important;
  box-shadow: 0 0 0.9rem var(--glow-gold), inset 0 0 0.2rem rgba(255, 255, 255, 0.1) !important;
}

.herb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.herb-grid div {
  border: 1px solid rgba(196, 179, 115, 0.25);
  border-radius: 10px;
  padding: 0.42rem;
  background: rgba(30, 35, 39, 0.5);
}

.herb-grid span {
  display: block;
  color: #b8c6c8;
  font-size: 0.76rem;
}

.herb-grid strong {
  font-size: 0.94rem;
  color: #efe6c8;
}

.event-card {
  border: 1px solid rgba(142, 202, 195, 0.24);
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(13, 31, 50, 0.83), rgba(9, 24, 39, 0.62));
  padding: 0.6rem;
  margin-bottom: 0.6rem;
}

.event-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.event-head img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.event-card p {
  margin: 0.35rem 0 0.55rem;
  color: #bed5df;
  font-size: 0.88rem;
}

.skill-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

.skill-row .secondary {
  margin-top: 0;
}

.meter {
  width: 100%;
  height: 8px;
  background: rgba(175, 196, 206, 0.16);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(138, 176, 191, 0.16);
}

.meter > div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
  box-shadow: 0 0 0.65rem rgba(126, 228, 216, 0.26);
}

#corruption-fill {
  background: linear-gradient(90deg, #76c48e, #e0b26f, #d06d6d);
}

#demon-fill {
  background: linear-gradient(90deg, #6ed6cb, #7ea6f0);
}

.log {
  margin: 0.4rem 0 0;
  padding-left: 1rem;
  max-height: 220px;
  overflow: auto;
  font-size: 0.82rem;
  color: #c8dbe3;
}

.log li {
  margin-bottom: 0.25rem;
}

.legal-note {
  text-align: center;
  font-size: 0.78rem;
  color: #91abb6;
  padding: 0 0.8rem 1rem;
}

[data-tip] {
  position: relative;
}

[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  min-width: 140px;
  max-width: 240px;
  width: max-content;
  white-space: normal;
  text-align: center;
  font-size: 0.76rem;
  line-height: 1.25;
  color: #eaf5f0;
  background: rgba(4, 15, 27, 0.96);
  border: 1px solid rgba(130, 204, 193, 0.45);
  border-radius: 8px;
  padding: 0.38rem 0.45rem;
  z-index: 70;
  pointer-events: none;
}

[data-tip]:hover::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%) rotate(45deg);
  width: 9px;
  height: 9px;
  background: rgba(4, 15, 27, 0.96);
  border-right: 1px solid rgba(130, 204, 193, 0.45);
  border-bottom: 1px solid rgba(130, 204, 193, 0.45);
  z-index: 69;
  pointer-events: none;
}

.toast-stack {
  position: fixed;
  right: 0.9rem;
  bottom: 0.9rem;
  z-index: 80;
  display: grid;
  gap: 0.45rem;
  pointer-events: none;
}

.toast {
  min-width: 190px;
  max-width: 320px;
  border-radius: 10px;
  border: 1px solid rgba(135, 198, 187, 0.44);
  background: rgba(8, 25, 40, 0.95);
  color: #ebf7f4;
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 0.48rem 0.58rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast-message {
  display: block;
  flex: 1;
}

.toast-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  padding: 0.18rem 0.3rem;
  border-radius: 999px;
  border: 1px solid rgba(180, 210, 224, 0.45);
  background: rgba(51, 83, 107, 0.5);
  color: #dce8ee;
  font-size: 0.65rem;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.toast-badge-info {
  border-color: rgba(126, 179, 221, 0.65);
  background: rgba(47, 81, 122, 0.62);
  color: #d7e8ff;
}

.toast-badge-manual {
  border-color: rgba(111, 214, 203, 0.7);
  background: rgba(30, 92, 88, 0.65);
  color: #d9fff9;
}

.toast-badge-upgrade {
  border-color: rgba(215, 193, 127, 0.72);
  background: rgba(96, 77, 33, 0.65);
  color: #fff1c8;
}

.toast-badge-combat {
  border-color: rgba(222, 125, 125, 0.72);
  background: rgba(111, 42, 42, 0.66);
  color: #ffdcdc;
}

.toast-badge-tribulation {
  border-color: rgba(130, 170, 236, 0.75);
  background: rgba(52, 70, 126, 0.68);
  color: #deebff;
}

.toast-badge-breakthrough {
  border-color: rgba(160, 236, 169, 0.75);
  background: rgba(50, 106, 60, 0.68);
  color: #e3ffe4;
}

.toast-badge-done {
  border-color: rgba(177, 241, 190, 0.8);
  background: rgba(47, 114, 59, 0.72);
  color: #ecffe8;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(3, 10, 18, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem;
}

.modal-card {
  width: min(760px, 100%);
  border-radius: 14px;
  border: 1px solid rgba(137, 203, 197, 0.38);
  background: rgba(7, 22, 37, 0.98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  padding: 0.85rem;
}

.modal-card h3 {
  margin-bottom: 0.35rem;
}

.modal-card p {
  margin: 0.25rem 0 0.55rem;
  color: #b8ced7;
  font-size: 0.86rem;
}

.modal-input {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid rgba(137, 203, 197, 0.3);
  background: rgba(12, 28, 45, 0.9);
  color: #e8f4f8;
  padding: 0.6rem;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.8rem;
  line-height: 1.35;
}

.modal-feedback {
  min-height: 1.3rem;
}

.modal-feedback.ok {
  color: #9ae2ab;
}

.modal-feedback.error {
  color: #f3a7a7;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.modal-actions .secondary,
.modal-actions .ghost {
  width: auto;
  margin-top: 0;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: rgba(121, 194, 130, 0.62);
  background: rgba(18, 44, 33, 0.95);
}

.toast.info {
  border-color: rgba(126, 179, 221, 0.58);
  background: rgba(13, 29, 48, 0.95);
}

.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 73;
  background: rgba(3, 10, 18, 0.54);
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(2, 10, 18, 0.54);
}

.menu-sheet {
  position: fixed;
  top: 152px;
  right: max(1rem, calc((100vw - 1320px) / 2 + 1rem));
  bottom: 1rem;
  width: min(540px, 94vw);
  z-index: 72;
  overflow: auto;
  margin: 0;
  padding-top: 2.6rem;
}

.menu-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: auto;
  margin: 0;
  padding: 0.34rem 0.62rem;
  min-height: auto;
  border-radius: 999px;
  font-size: 0.75rem;
}

.fab-rail {
  display: none;
}

.fab-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid rgba(214, 190, 121, 0.46);
  background: linear-gradient(165deg, rgba(31, 58, 84, 0.95), rgba(14, 30, 47, 0.94));
  color: #f0f6f8;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  box-shadow: 0 0.6rem 1.2rem rgba(0, 0, 0, 0.38), 0 0 0.7rem rgba(220, 191, 121, 0.2);
}

.fab-btn:hover {
  box-shadow: 0 0.75rem 1.35rem rgba(0, 0, 0, 0.42), 0 0 0.85rem rgba(126, 228, 216, 0.32);
}

.fab-btn.fab-active {
  border-color: rgba(126, 228, 216, 0.78);
  box-shadow: 0 0.85rem 1.5rem rgba(0, 0, 0, 0.44), 0 0 0.95rem rgba(126, 228, 216, 0.42);
}

body.mobile-drawer-lock {
  overflow: hidden;
}

@media (max-width: 1160px) {
  .hero-panel {
    width: min(700px, 96vw);
  }

  .menu-sheet {
    right: 0.8rem;
    width: min(520px, 94vw);
  }
}

@media (max-width: 800px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.75rem 0.75rem 0.8rem;
  }

  .topbar-left {
    width: 100%;
    align-items: flex-start;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 0.38rem;
  }

  .top-actions .ghost,
  .top-actions .danger {
    min-height: 44px;
  }

  .resource-strip {
    top: 96px;
    width: calc(100% - 0.75rem);
    margin: 0.3rem auto 0;
    border-radius: 10px;
    padding: 0.36rem;
    gap: 0.3rem;
  }

  .resource-chip {
    padding: 0.29rem 0.4rem;
  }

  .resource-chip span {
    font-size: 0.64rem;
  }

  .resource-chip strong {
    font-size: 0.74rem;
  }

  .layout {
    min-height: calc(100vh - 184px);
    padding: 0.75rem 0.35rem 4.6rem;
  }

  .hero-panel {
    width: min(96vw, 560px);
  }

  #hero-panel.hero-stage {
    padding-bottom: 1rem;
  }

  .gong-button {
    width: 190px;
    height: 190px;
  }

  .ring-menu {
    display: none;
  }

  .menu-orb {
    min-height: 44px;
  }

  .mobile-drawer-panel {
    position: fixed;
    top: 180px;
    right: 0.45rem;
    bottom: 0.55rem;
    width: min(92vw, 430px);
    margin: 0;
    z-index: 74;
    overflow: auto;
    transform: translateX(112%);
    opacity: 0.2;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease;
  }

  .mobile-drawer-panel.drawer-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .fab-rail {
    position: fixed;
    right: 0.55rem;
    bottom: 0.8rem;
    z-index: 78;
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
  }

  .fab-btn {
    width: 52px;
    height: 52px;
  }

  .menu-close {
    min-height: 32px;
    font-size: 0.72rem;
  }

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

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

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

  .recipe-actions {
    grid-template-columns: 1fr;
  }

  .expedition-choice-actions {
    grid-template-columns: 1fr;
  }

  .dao-cta {
    min-height: 48px;
  }

  .hero-seal {
    width: 52px;
    height: 52px;
    right: 0.45rem;
    bottom: 0.35rem;
  }

  .toast-stack {
    left: 0.35rem;
    right: 3.7rem;
    bottom: 0.7rem;
  }

  .toast {
    max-width: 100%;
  }
}
