:root {
  color-scheme: dark;
  --bg: #0b0d0e;
  --panel: rgba(18, 22, 22, 0.84);
  --panel-solid: #121616;
  --line: rgba(243, 211, 142, 0.18);
  --text: #f7efe0;
  --muted: #b8afa0;
  --gold: #f4b24d;
  --teal: #34d3c4;
  --coral: #f2665f;
  --green: #7ddc8b;
  --paper: #fff2c6;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 14%, rgba(52, 211, 196, 0.18), transparent 30%),
    radial-gradient(circle at 88% 16%, rgba(242, 102, 95, 0.15), transparent 26%),
    linear-gradient(145deg, #0b0d0e 0%, #15120f 48%, #071211 100%);
  font-family:
    "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.ambient-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(255, 242, 198, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 242, 198, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

.music-toggle {
  position: fixed;
  z-index: 30;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: inline-flex;
  min-height: 40px;
  min-width: 88px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 242, 198, 0.22);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--paper);
  background: rgba(18, 22, 22, 0.78);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
  font-size: 0.84rem;
  font-weight: 900;
}

.music-toggle:hover,
.music-toggle:focus-visible {
  border-color: rgba(52, 211, 196, 0.58);
  outline: none;
}

.music-toggle.is-on {
  border-color: rgba(244, 178, 77, 0.64);
  background: rgba(48, 32, 18, 0.86);
}

.music-toggle__icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: #08100f;
  background: var(--teal);
  line-height: 1;
}

.music-toggle.is-on .music-toggle__icon {
  background: var(--gold);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.84fr) minmax(320px, 1fr);
  gap: 28px;
  min-height: calc(100svh - 130px);
  align-items: stretch;
  padding: 24px;
  border: 1px solid rgba(244, 178, 77, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(11, 13, 14, 0.94) 0%, rgba(11, 13, 14, 0.68) 38%, rgba(11, 13, 14, 0.18) 100%),
    url("/assets/puduni-shrine.png") right 44% center / min(72vw, 980px) auto no-repeat;
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  min-height: 430px;
  flex-direction: column;
  justify-content: flex-start;
  padding: 28px 0 12px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--paper);
  font-size: clamp(3.8rem, 10vw, 8rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.tagline {
  width: min(100%, 430px);
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.3vw, 1.45rem);
  line-height: 1.6;
}

.oracle-console,
.tool-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.oracle-console {
  align-self: end;
  min-width: 0;
  padding: 18px;
}

.console-header,
.panel-title,
.form-actions,
.combo-line,
.pill-row {
  display: flex;
  align-items: center;
}

.console-header {
  gap: 10px;
  min-height: 34px;
  color: var(--paper);
  font-size: 0.86rem;
  font-weight: 800;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px rgba(125, 220, 139, 0.9);
}

.console-code {
  margin-left: auto;
  color: var(--teal);
  font-size: 0.76rem;
}

.trouble-form,
.burn-form {
  display: grid;
  gap: 12px;
}

.trouble-form {
  margin-top: 12px;
}

textarea,
input {
  width: 100%;
  border: 1px solid rgba(255, 242, 198, 0.18);
  border-radius: 6px;
  outline: none;
  color: var(--text);
  background: rgba(0, 0, 0, 0.32);
}

textarea {
  min-height: 136px;
  resize: vertical;
  padding: 14px;
  line-height: 1.6;
}

input {
  height: 46px;
  padding: 0 13px;
}

textarea:focus,
input:focus {
  border-color: rgba(52, 211, 196, 0.72);
  box-shadow: 0 0 0 3px rgba(52, 211, 196, 0.12);
}

textarea::placeholder,
input::placeholder {
  color: rgba(247, 239, 224, 0.42);
}

.form-actions {
  justify-content: flex-end;
  gap: 10px;
}

.primary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 6px;
  padding: 0 16px;
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(135deg, var(--coral), var(--gold));
  color: #170d09;
}

.ghost-button {
  border-color: rgba(255, 242, 198, 0.18);
  background: rgba(255, 242, 198, 0.06);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.result-board {
  margin-top: 16px;
  padding: 16px;
  border: 1px dashed rgba(244, 178, 77, 0.28);
  border-radius: 6px;
  background: rgba(255, 242, 198, 0.055);
}

.result-board.is-fresh {
  animation: pulse-board 420ms ease;
}

.result-kicker,
.panel-title p {
  margin: 0;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
}

.result-board h2,
.daily-panel h2 {
  margin: 8px 0 0;
  color: var(--paper);
  font-size: clamp(1.35rem, 2.8vw, 2rem);
  letter-spacing: 0;
}

.mantra,
.daily-panel > p,
.burn-output {
  margin: 12px 0 0;
  color: var(--text);
  line-height: 1.72;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
}

.result-grid div {
  min-width: 0;
  padding: 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.26);
}

dt {
  color: var(--muted);
  font-size: 0.74rem;
}

dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  color: var(--paper);
  font-weight: 800;
}

.tools {
  display: grid;
  grid-template-columns: 0.8fr 1.1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.tool-card {
  min-width: 0;
  min-height: 250px;
  padding: 18px;
}

.panel-title {
  justify-content: space-between;
  gap: 12px;
}

.panel-title strong {
  color: var(--gold);
  font-size: 1.12rem;
}

.muyu-panel {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.muyu-panel .panel-title,
.muyu-panel .combo-line {
  width: 100%;
}

.muyu-button {
  position: relative;
  display: grid;
  width: min(190px, 62vw);
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(244, 178, 77, 0.34);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #c9873e 0 10%, transparent 11%),
    radial-gradient(circle at 50% 58%, #8a4f27, #4a2818 64%, #21110d 100%);
  box-shadow:
    inset -18px -24px 38px rgba(0, 0, 0, 0.42),
    0 18px 52px rgba(242, 102, 95, 0.18);
}

.muyu-button:active {
  transform: scale(0.98);
}

.muyu-core {
  width: 34%;
  height: 13%;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  box-shadow: 0 0 0 10px rgba(255, 242, 198, 0.04);
}

.combo-line {
  justify-content: center;
  gap: 10px;
  color: var(--muted);
}

.combo-line strong {
  color: var(--green);
}

.float-merit {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  color: var(--paper);
  font-size: 0.92rem;
  font-weight: 900;
  text-shadow: 0 0 18px rgba(244, 178, 77, 0.78);
  animation: float-up 900ms ease forwards;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.daily-panel {
  display: flex;
  flex-direction: column;
}

.pill-row {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.pill-row span {
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(52, 211, 196, 0.22);
  border-radius: 999px;
  color: var(--paper);
  background: rgba(52, 211, 196, 0.08);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.wide {
  width: 100%;
  margin-top: auto;
}

.burn-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.burn-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.burner {
  display: flex;
  height: 96px;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(242, 102, 95, 0.22);
  border-radius: 6px;
  background:
    linear-gradient(to top, rgba(242, 102, 95, 0.18), transparent 56%),
    rgba(0, 0, 0, 0.28);
}

.burner span {
  display: block;
  width: 18px;
  height: 42px;
  border-radius: 50% 50% 28% 28%;
  background: linear-gradient(to top, var(--coral), var(--gold), var(--paper));
  transform-origin: bottom center;
  animation: flame 860ms ease-in-out infinite alternate;
}

.burner span:nth-child(2) {
  height: 62px;
  animation-delay: 120ms;
}

.burner span:nth-child(3) {
  height: 38px;
  animation-delay: 240ms;
}

.burner.is-burning {
  animation: pulse-board 520ms ease;
}

.community {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 18px;
  margin-top: 18px;
}

.identity-panel,
.treehole-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 22, 22, 0.78);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.identity-panel {
  align-self: start;
  padding: 18px;
}

.treehole-panel {
  padding: 18px;
}

.nickname-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 18px;
}

.profile-strip {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.profile-strip span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-strip code {
  color: var(--teal);
  font-family: inherit;
  font-weight: 800;
  white-space: nowrap;
}

.treehole-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.mood-row,
.treehole-actions {
  display: flex;
  align-items: center;
}

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

.mood-chip,
.incense-button {
  min-height: 34px;
  border: 1px solid rgba(255, 242, 198, 0.16);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 242, 198, 0.06);
  font-weight: 800;
}

.mood-chip {
  padding: 0 12px;
}

.mood-chip.is-active {
  border-color: rgba(52, 211, 196, 0.54);
  color: #06100f;
  background: var(--teal);
}

.treehole-actions {
  justify-content: space-between;
  gap: 12px;
}

.treehole-actions span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.treehole-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.treehole-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed rgba(255, 242, 198, 0.16);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
}

.treehole-post {
  padding: 14px;
  border: 1px solid rgba(255, 242, 198, 0.14);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.treehole-post header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.treehole-post header div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.treehole-post strong {
  color: var(--paper);
  overflow-wrap: anywhere;
}

.treehole-post header span {
  color: var(--muted);
  font-size: 0.78rem;
}

.treehole-post p {
  margin: 12px 0 0;
  color: var(--text);
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.incense-button {
  flex: 0 0 auto;
  padding: 0 12px;
}

.incense-button:hover {
  border-color: rgba(244, 178, 77, 0.46);
  color: var(--paper);
}

@keyframes pulse-board {
  0% {
    box-shadow: 0 0 0 rgba(244, 178, 77, 0);
  }
  55% {
    box-shadow: 0 0 34px rgba(244, 178, 77, 0.32);
  }
  100% {
    box-shadow: 0 0 0 rgba(244, 178, 77, 0);
  }
}

@keyframes float-up {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  18% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateY(-54px) scale(1.04);
  }
}

@keyframes flame {
  from {
    transform: scaleY(0.84) rotate(-3deg);
    filter: saturate(1);
  }
  to {
    transform: scaleY(1.08) rotate(3deg);
    filter: saturate(1.35);
  }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    background:
      linear-gradient(to bottom, rgba(11, 13, 14, 0.54), rgba(11, 13, 14, 0.96) 44%),
      url("/assets/puduni-shrine.png") center top / min(110vw, 860px) auto no-repeat;
  }

  .hero-copy {
    min-height: 360px;
    justify-content: flex-start;
    padding-top: 18px;
  }

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

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

  .burn-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .hero {
    padding: 14px;
    gap: 16px;
    background-size: 680px auto;
  }

  .hero-copy {
    min-height: 300px;
    padding-top: 10px;
  }

  .oracle-console,
  .tool-card {
    padding: 14px;
  }

  .form-actions,
  .nickname-form,
  .burn-form {
    grid-template-columns: 1fr;
  }

  .form-actions {
    display: grid;
  }

  .profile-strip,
  .treehole-actions,
  .treehole-post header {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .result-grid,
  .tools {
    grid-template-columns: 1fr;
  }

  .tool-card,
  .burn-panel {
    grid-column: auto;
  }
}
