:root {
  --ed-ink: #fdf1e0;
  --ed-muted: #b0a396;
  --ed-panel: rgba(22, 18, 30, 0.88);
  --ed-panel-solid: #1b1622;
  --ed-line: rgba(255, 186, 122, 0.22);
  --ed-ember: #ff8a3d;
  --ed-gold: #ffc766;
  --ed-crystal: #7ef0ff;
  --ed-moss: #7fc98a;
  --ed-blood: #ff6b5a;
  --ed-shadow: rgba(4, 2, 10, 0.55);
}

#game-root {
  --ed-ink: #fdf1e0;
  --ed-muted: #b0a396;
  --ed-panel: rgba(22, 18, 30, 0.88);
  --ed-panel-solid: #1b1622;
  --ed-line: rgba(255, 186, 122, 0.22);
  --ed-ember: #ff8a3d;
  --ed-gold: #ffc766;
  --ed-crystal: #7ef0ff;
  --ed-moss: #7fc98a;
  --ed-blood: #ff6b5a;
  color: var(--ed-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0.01em;
  max-width: 100%;
  overflow: hidden;
}

#game-root *,
#game-root *::before,
#game-root *::after {
  box-sizing: border-box;
}

.ed-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 16px 18px 24px;
  color: var(--ed-ink);
  position: relative;
  isolation: isolate;
}

.ed-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 18% 0%, rgba(255, 138, 61, 0.16), transparent 36%), radial-gradient(circle at 92% 52%, rgba(126, 240, 255, 0.1), transparent 34%);
  pointer-events: none;
}

.ed-topbar,
.ed-quest,
.ed-lower,
.ed-tip {
  width: 100%;
}

.ed-topbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.ed-stats {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.ed-stat {
  min-width: 62px;
  padding: 7px 9px 6px;
  border: 1px solid var(--ed-line);
  border-radius: 11px;
  background: linear-gradient(150deg, rgba(58, 34, 40, 0.82), rgba(16, 13, 24, 0.9));
  box-shadow: 0 8px 18px rgba(3, 2, 8, 0.3);
}

.ed-stat span,
.ed-note strong,
.ed-kicker,
.ed-chip b,
.ed-slot b,
.ed-dial-card span,
.ed-result-best,
.ed-dial-card strong,
.ed-recipe-key,
.ed-stick span,
.ed-touch-btn {
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ed-stat span {
  display: block;
  color: var(--ed-muted);
  margin-bottom: 2px;
}

.ed-stat strong {
  display: block;
  font-size: 15px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.ed-stat-vitals {
  min-width: 108px;
}

.ed-stat-vitals strong {
  margin-top: 3px;
  font-size: 14px;
}

.ed-bar {
  display: block;
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-top: 4px;
}

.ed-bar b {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #5fd6a8, #9ff0c8);
  transition: width 180ms ease;
}

.ed-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.ed-btn {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(255, 200, 150, 0.26);
  border-radius: 12px;
  padding: 10px 15px;
  color: var(--ed-ink);
  background: rgba(32, 22, 32, 0.86);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 130ms ease, border-color 130ms ease, background 130ms ease, opacity 130ms ease;
}

.ed-btn:hover,
.ed-btn:focus-visible {
  border-color: var(--ed-gold);
  background: rgba(66, 38, 38, 0.92);
  transform: translateY(-1px);
  outline: none;
}

.ed-btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.ed-icon {
  padding: 10px 12px;
}

.ed-primary {
  background: linear-gradient(150deg, #ff9d4d, #f0662c);
  border-color: rgba(255, 214, 160, 0.5);
  color: #2a1105;
}

.ed-primary:hover,
.ed-primary:focus-visible {
  background: linear-gradient(150deg, #ffb46a, #ff7b39);
  border-color: #ffe0b0;
}

.ed-large {
  width: 100%;
  min-height: 50px;
  font-size: 13px;
}

.ed-quest {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--ed-line);
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(60, 32, 30, 0.7), rgba(18, 14, 26, 0.86));
}

.ed-quest-main {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1 1 260px;
}

.ed-quest-main i {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ed-ember);
  box-shadow: 0 0 0 4px rgba(255, 138, 61, 0.18), 0 0 14px rgba(255, 138, 61, 0.6);
}

.ed-quest-main span {
  display: block;
  color: var(--ed-gold);
  margin-bottom: 2px;
}

.ed-quest-main strong {
  display: block;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ed-ink);
}

.ed-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.ed-quest-chip {
  padding: 5px 9px;
  border-radius: 99px;
  border: 1px solid rgba(255, 186, 122, 0.24);
  background: rgba(12, 10, 18, 0.7);
  color: var(--ed-muted);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.ed-quest-chip-done {
  color: #1d2a18;
  background: linear-gradient(140deg, #9fe0a8, #6fc47f);
  border-color: rgba(190, 255, 200, 0.5);
}

.ed-stage {
  position: relative;
  width: 100%;
  height: min(62vh, 560px);
  min-height: 340px;
  border: 1px solid var(--ed-line);
  border-radius: 18px;
  overflow: hidden;
  background: #10101c;
  box-shadow: 0 20px 44px rgba(3, 2, 10, 0.45);
}

.ed-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  outline: none;
}

.ed-canvas:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(255, 199, 102, 0.6);
}

.ed-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 46%, rgba(0, 0, 0, 0) 44%, rgba(4, 2, 10, 0.55) 100%);
}

.ed-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 55%, rgba(255, 60, 40, 0.1), rgba(180, 20, 20, 0.62));
  transition: opacity 90ms linear;
}

.ed-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.ed-dial-card {
  position: relative;
  width: 92px;
  flex: 0 0 auto;
  text-align: center;
  padding: 4px 6px 8px;
  border: 1px solid var(--ed-line);
  border-radius: 14px;
  background: var(--ed-panel);
  box-shadow: 0 10px 24px rgba(3, 2, 10, 0.4);
}

.ed-dial-card canvas {
  width: 84px;
  height: 84px;
  display: block;
  margin: 0 auto;
}

.ed-dial-card strong {
  display: block;
  color: var(--ed-crystal);
  font-size: 10px;
  letter-spacing: 0.08em;
  margin-top: -4px;
}

.ed-dial-card strong[data-live="0"] {
  color: var(--ed-muted);
}

.ed-dial-card span {
  display: block;
  color: var(--ed-muted);
  font-size: 9px;
  margin-top: 2px;
}

.ed-satchel {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 62%;
}

.ed-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid var(--ed-line);
  border-radius: 11px;
  background: var(--ed-panel);
  box-shadow: 0 8px 18px rgba(3, 2, 10, 0.32);
}

.ed-chip i,
.ed-slot i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.ed-chip b {
  color: var(--ed-muted);
}

.ed-chip strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.ed-hotbar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--ed-line);
  border-radius: 16px;
  background: var(--ed-panel);
  box-shadow: 0 14px 30px rgba(3, 2, 10, 0.5);
  max-width: calc(100% - 24px);
  overflow-x: auto;
}

.ed-slot {
  position: relative;
  width: 62px;
  min-width: 62px;
  height: 62px;
  border: 1px solid rgba(255, 186, 122, 0.2);
  border-radius: 12px;
  background: rgba(30, 22, 32, 0.9);
  color: var(--ed-ink);
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}

.ed-slot span {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: 9px;
  color: var(--ed-muted);
}

.ed-slot strong {
  position: absolute;
  right: 5px;
  bottom: 3px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ed-slot b {
  color: var(--ed-muted);
  font-size: 9px;
  margin-top: 2px;
}

.ed-slot-on {
  border-color: var(--ed-gold);
  background: linear-gradient(150deg, rgba(255, 157, 77, 0.34), rgba(48, 26, 30, 0.94));
  box-shadow: 0 0 0 2px rgba(255, 199, 102, 0.28);
}

.ed-banner {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translate(-50%, -8px);
  max-width: min(84%, 460px);
  padding: 10px 16px;
  border: 1px solid var(--ed-line);
  border-radius: 12px;
  background: rgba(18, 12, 20, 0.92);
  color: var(--ed-ink);
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
  box-shadow: 0 14px 30px rgba(3, 2, 10, 0.5);
}

.ed-banner-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.ed-banner[data-kind="warn"] {
  border-color: rgba(255, 138, 61, 0.6);
  color: #ffd9b0;
}

.ed-banner[data-kind="good"] {
  border-color: rgba(126, 240, 255, 0.5);
  color: #cbf6ff;
}

.ed-touch {
  position: absolute;
  inset: auto 0 0 0;
  height: 168px;
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  padding: 12px 14px 16px;
  pointer-events: none;
}

.ed-stick {
  position: relative;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  border: 1px solid rgba(255, 186, 122, 0.3);
  background: rgba(22, 16, 26, 0.55);
  pointer-events: auto;
  touch-action: none;
}

.ed-stick b {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: 0;
  border-radius: 50%;
  background: rgba(255, 199, 102, 0.75);
  transform: translate(-50%, -50%);
  box-shadow: 0 6px 14px rgba(3, 2, 10, 0.5);
}

.ed-stick span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  text-align: center;
  color: rgba(255, 241, 224, 0.6);
  font-size: 9px;
}

.ed-touch-actions {
  display: grid;
  grid-template-columns: repeat(2, 62px);
  gap: 8px;
  pointer-events: auto;
}

.ed-touch-btn {
  min-width: 62px;
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid rgba(255, 186, 122, 0.3);
  background: rgba(34, 24, 32, 0.82);
  color: var(--ed-ink);
  font: inherit;
  cursor: pointer;
  touch-action: none;
}

.ed-touch-jump {
  background: linear-gradient(150deg, rgba(126, 240, 255, 0.28), rgba(28, 40, 52, 0.9));
}

.ed-touch-btn[aria-pressed="true"] {
  border-color: var(--ed-gold);
  background: rgba(255, 157, 77, 0.4);
}

.ed-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(circle at 50% 40%, rgba(12, 8, 18, 0.72), rgba(6, 4, 12, 0.92));
  backdrop-filter: blur(3px);
  z-index: 5;
}

.ed-hidden {
  display: none !important;
}

.ed-card {
  width: min(460px, 100%);
  max-height: 100%;
  overflow-y: auto;
  text-align: center;
  padding: 22px 22px 20px;
  border: 1px solid var(--ed-line);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(48, 26, 34, 0.94), rgba(16, 12, 24, 0.96));
  box-shadow: 0 26px 60px rgba(2, 1, 8, 0.6);
}

.ed-kicker {
  display: block;
  color: var(--ed-gold);
  margin-bottom: 8px;
}

.ed-card h1,
.ed-card h2 {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.ed-card h2 {
  font-size: 22px;
}

.ed-card p {
  margin: 0 0 12px;
  color: #e6d8c8;
  font-size: 13px;
  line-height: 1.55;
}

.ed-card small {
  display: block;
  margin-top: 10px;
  color: var(--ed-muted);
  font-size: 11px;
  line-height: 1.5;
}

.ed-result-score {
  display: block;
  font-size: 34px;
  font-weight: 800;
  color: var(--ed-gold);
  margin: 2px 0 8px;
  font-variant-numeric: tabular-nums;
}

.ed-result-best {
  color: var(--ed-muted);
  margin-bottom: 14px;
}

.ed-card-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.ed-card-actions .ed-btn {
  flex: 1 1 130px;
}

.ed-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 3, 10, 0.78);
  backdrop-filter: blur(4px);
}

.ed-modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px 26px 22px;
  border: 1px solid var(--ed-line);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(48, 26, 34, 0.97), rgba(16, 12, 24, 0.98));
  box-shadow: 0 26px 60px rgba(2, 1, 8, 0.65);
}

.ed-modal-card h2 {
  margin: 0 0 12px;
  font-size: 22px;
}

.ed-modal-card p {
  margin: 0 0 12px;
  color: #e6d8c8;
  font-size: 13px;
  line-height: 1.6;
}

.ed-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--ed-line);
  background: rgba(30, 20, 30, 0.9);
  color: var(--ed-ink);
  font-size: 20px;
  cursor: pointer;
}

.ed-modal-foot {
  color: var(--ed-muted);
  font-size: 12px;
}

.ed-recipes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 12px;
}

.ed-recipe {
  position: relative;
  text-align: left;
  padding: 12px 12px 10px;
  border: 1px solid rgba(255, 186, 122, 0.2);
  border-radius: 14px;
  background: rgba(26, 18, 28, 0.9);
  color: var(--ed-ink);
  font: inherit;
  cursor: pointer;
  min-height: 44px;
}

.ed-recipe.ed-ready {
  border-color: rgba(255, 199, 102, 0.6);
  background: linear-gradient(150deg, rgba(66, 36, 32, 0.95), rgba(30, 20, 30, 0.95));
}

.ed-recipe-key {
  position: absolute;
  top: 8px;
  right: 10px;
  color: var(--ed-muted);
}

.ed-recipe strong {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
}

.ed-recipe ul {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ed-recipe li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--ed-muted);
}

.ed-recipe li i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.ed-recipe li.ed-have {
  color: #b8e8c0;
}

.ed-recipe li.ed-short {
  color: #ffb2a6;
}

.ed-recipe em {
  display: block;
  font-style: normal;
  color: #cdbcaa;
  font-size: 11px;
  line-height: 1.45;
}

.ed-lower {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.ed-note {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--ed-line);
  border-radius: 14px;
  background: linear-gradient(150deg, rgba(44, 26, 34, 0.62), rgba(16, 12, 24, 0.82));
}

.ed-note > span {
  font-size: 18px;
  font-weight: 800;
  color: rgba(255, 199, 102, 0.7);
  line-height: 1;
}

.ed-note strong {
  display: block;
  color: var(--ed-ink);
  margin-bottom: 3px;
}

.ed-note p {
  margin: 0;
  color: #cbbdae;
  font-size: 12px;
  line-height: 1.5;
}

.ed-tip {
  margin: 12px 0 0;
  color: var(--ed-muted);
  font-size: 12px;
  line-height: 1.5;
}

@media (pointer: coarse) {
  .ed-touch {
    display: flex;
  }

  .ed-hotbar {
    bottom: 178px;
  }

  .ed-banner {
    top: 16%;
  }
}

@media (max-width: 860px) {
  .ed-lower {
    grid-template-columns: 1fr;
  }

  .ed-stage {
    height: min(58vh, 480px);
  }
}

@media (max-width: 700px) {
  .ed-shell {
    padding: 12px 12px 20px;
  }

  .ed-topbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .ed-stats {
    flex: 1 1 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .ed-stat {
    min-width: 68px;
    padding: 7px 9px 6px;
  }

  .ed-stat strong {
    font-size: 15px;
  }

  .ed-stat-vitals {
    min-width: 118px;
  }

  .ed-actions {
    flex: 1 1 100%;
    justify-content: flex-end;
  }

  .ed-btn {
    flex: 1 1 auto;
    padding: 10px 12px;
  }

  .ed-quest {
    padding: 10px 12px;
  }

  .ed-chips {
    justify-content: flex-start;
  }

  .ed-stage {
    height: min(56vh, 430px);
    min-height: 300px;
    border-radius: 14px;
  }

  .ed-dial-card {
    width: 74px;
    padding: 3px 4px 6px;
  }

  .ed-dial-card canvas {
    width: 66px;
    height: 66px;
  }

  .ed-chip {
    padding: 5px 7px;
  }

  .ed-satchel {
    max-width: 58%;
  }

  .ed-slot {
    width: 54px;
    min-width: 54px;
    height: 56px;
  }

  .ed-card h1,
  .ed-card h2 {
    font-size: 21px;
  }

  .ed-recipes {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .ed-hotbar {
    gap: 6px;
    padding: 6px;
  }

  .ed-slot {
    width: 48px;
    min-width: 48px;
    height: 50px;
  }

  .ed-slot b {
    display: none;
  }

  .ed-touch {
    height: 150px;
  }

  .ed-stick {
    width: 104px;
    height: 104px;
  }

  .ed-touch-actions {
    grid-template-columns: repeat(2, 56px);
  }

  .ed-touch-btn {
    min-width: 56px;
    min-height: 46px;
    font-size: 9px;
  }
}
