:root {
  --bg: #130A0A;
  --surface-low: #0F0707;
  --surface: #241313;
  --surface-high: #2B1616;
  --surface-top: #361E1B;
  --border: #6A4832;
  --outline: #AA8E73;
  --primary: #E4543A;
  --primary-dark: #7A1F16;
  --gold: #F2B544;
  --gold-bright: #FFE3AA;
  --text: #F2E8D6;
  --text-soft: #D8C2A4;
  --text-muted: #AA8E73;
  --good: #7BC07E;
  --bad: #FFB4AB;
  --shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
  --glow: 0 0 38px rgba(242, 181, 68, 0.16);
  --font-body: "Be Vietnam Pro", sans-serif;
  --font-logo: "Beau Rivage", cursive;
}

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

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at 14% 8%, rgba(242, 181, 68, 0.18), transparent 29%),
    radial-gradient(circle at 86% 0%, rgba(228, 84, 58, 0.2), transparent 24%),
    linear-gradient(180deg, rgba(228, 84, 58, 0.12), transparent 190px),
    linear-gradient(180deg, var(--bg), var(--surface-low));
}

.app-aura {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.app-aura span {
  position: absolute;
  width: 210px;
  height: 210px;
  border: 1px solid rgba(242, 181, 68, 0.12);
  border-radius: 50%;
  opacity: 0.72;
}

.app-aura span:nth-child(1) {
  top: 96px;
  right: -86px;
  box-shadow: inset 0 0 60px rgba(228, 84, 58, 0.13);
}

.app-aura span:nth-child(2) {
  bottom: 122px;
  left: -118px;
  width: 260px;
  height: 260px;
  box-shadow: inset 0 0 70px rgba(242, 181, 68, 0.08);
}

.app-aura span:nth-child(3) {
  top: 42%;
  right: 18%;
  width: 84px;
  height: 84px;
  border-color: rgba(255, 227, 170, 0.08);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-root {
  min-height: 100vh;
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 14px 100px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 74px;
  padding: 12px 0;
  background: linear-gradient(180deg, var(--bg) 72%, rgba(19, 10, 10, 0));
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: hidden;
}

.brand-mark span {
  position: relative;
  z-index: 1;
}

.brand-logo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.22);
  filter: drop-shadow(0 0 10px rgba(242, 181, 68, 0.12));
}

.brand-mark i {
  display: none;
}

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

.brand-name {
  font-family: var(--font-logo);
  font-size: 2.2rem;
  line-height: 0.88;
  color: var(--gold-bright);
  white-space: nowrap;
}

.brand-time {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
}

.install-button,
.date-badge,
.pill,
.chip {
  border: 1px solid var(--border);
  background: rgba(242, 181, 68, 0.08);
  color: var(--gold-bright);
}

.install-button {
  min-width: 54px;
  height: 42px;
  border-radius: 8px;
  font-weight: 800;
}

.app-main {
  display: grid;
  gap: 14px;
}

.screen-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 6px 2px 2px;
}

.screen-kicker {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.screen-head h1 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: clamp(1.6rem, 3.8vw, 2.25rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.screen-art {
  position: relative;
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  margin-left: auto;
}

.screen-orbit {
  position: absolute;
  inset: 7px;
  border: 1px dashed rgba(242, 181, 68, 0.34);
  border-radius: 50%;
  transform: rotate(-18deg);
}

.screen-orbit::before,
.screen-orbit::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(242, 181, 68, 0.8);
}

.screen-orbit::before {
  top: 1px;
  left: 10px;
}

.screen-orbit::after {
  right: 2px;
  bottom: 11px;
  background: var(--primary);
}

.screen-symbol {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(242, 181, 68, 0.3);
  border-radius: 50%;
  color: var(--gold-bright);
  background: rgba(36, 19, 19, 0.88);
  box-shadow: var(--glow);
  font-size: 1.25rem;
}

.date-badge,
.pill,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.screen-body {
  display: grid;
  gap: 12px;
  animation: viewIn 180ms ease-out;
}

.loading-panel {
  min-height: 260px;
  display: grid;
  place-items: center;
  gap: 18px;
  text-align: center;
}

.loading-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.loading-mark span {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), var(--primary));
  box-shadow: 0 0 20px rgba(242, 181, 68, 0.3);
  animation: pulseDot 900ms ease-in-out infinite;
}

.loading-mark span:nth-child(2) {
  animation-delay: 120ms;
}

.loading-mark span:nth-child(3) {
  animation-delay: 240ms;
}

.loading-title {
  color: var(--gold-bright);
  font-size: 1.1rem;
  font-weight: 800;
}

.loading-text {
  margin: 8px 0 0;
  max-width: 320px;
  color: var(--text-soft);
  line-height: 1.55;
}

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

@keyframes pulseDot {
  0%,
  100% {
    transform: translateY(0) scale(0.9);
    opacity: 0.55;
  }
  50% {
    transform: translateY(-6px) scale(1.05);
    opacity: 1;
  }
}

.panel,
.tool-panel,
.hour-card,
.result-card,
.metric {
  border: 1px solid rgba(106, 72, 50, 0.74);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(43, 22, 22, 0.96), rgba(36, 19, 19, 0.96));
  box-shadow: var(--shadow);
}

.panel {
  position: relative;
  overflow: hidden;
  padding: 14px;
}

.hero-panel {
  background:
    radial-gradient(circle at 92% 14%, rgba(255, 227, 170, 0.14), transparent 26%),
    linear-gradient(135deg, rgba(122, 31, 22, 0.96), rgba(43, 22, 22, 0.98)),
    var(--surface-high);
}

.hero-panel::after {
  content: "";
  position: absolute;
  right: -44px;
  bottom: -64px;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(242, 181, 68, 0.12);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 49%, rgba(242, 181, 68, 0.09) 50%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgba(242, 181, 68, 0.09) 50%, transparent 51%);
  opacity: 0.82;
}

.hero-panel > * {
  position: relative;
  z-index: 1;
}

.visual-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

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

.card-visual {
  position: relative;
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(242, 181, 68, 0.2);
  border-radius: 22px;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 227, 170, 0.2), transparent 28%),
    linear-gradient(145deg, rgba(15, 7, 7, 0.34), rgba(242, 181, 68, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 227, 170, 0.04), var(--glow);
}

.card-visual::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px dashed rgba(255, 227, 170, 0.2);
  border-radius: 50%;
}

.card-visual::after {
  content: "";
  position: absolute;
  right: 17px;
  top: 16px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(242, 181, 68, 0.82);
}

.visual-symbol {
  position: relative;
  z-index: 1;
  color: var(--gold-bright);
  font-size: 2.4rem;
  line-height: 1;
  text-shadow: 0 0 26px rgba(242, 181, 68, 0.34);
}

.today-grid,
.metrics-grid,
.tool-grid,
.result-grid,
.hours-grid {
  display: grid;
  gap: 10px;
}

.today-grid {
  margin-top: 14px;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
}

.today-grid-home {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
}

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

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

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

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

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

.section-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.large-value {
  margin-top: 6px;
  color: var(--gold-bright);
  font-family: var(--font-logo);
  font-size: clamp(3.2rem, 12vw, 5.6rem);
  line-height: 0.84;
}

.value-title {
  margin: 4px 0 0;
  color: var(--gold-bright);
  font-size: 1.35rem;
  line-height: 1.15;
  font-weight: 800;
}

.mini-panel {
  min-height: 100%;
  padding: 12px;
  border: 1px solid rgba(242, 181, 68, 0.14);
  border-radius: 8px;
  background: rgba(15, 7, 7, 0.2);
}

.body-copy,
.small-copy {
  color: var(--text-soft);
  line-height: 1.48;
}

.body-copy {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.small-copy {
  margin: 4px 0 0;
  font-size: 0.84rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.chip.good {
  color: var(--good);
  border-color: rgba(123, 192, 126, 0.44);
  background: rgba(123, 192, 126, 0.08);
}

.chip.bad {
  color: var(--bad);
  border-color: rgba(255, 180, 171, 0.36);
  background: rgba(255, 180, 171, 0.08);
}

.metric {
  padding: 12px;
  box-shadow: none;
}

.metric,
.result-card,
.hour-card,
.quick-button {
  position: relative;
  overflow: hidden;
}

.metric::after,
.result-card::after,
.hour-card::after,
.quick-button::after {
  content: "";
  position: absolute;
  top: -38px;
  right: -34px;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: rgba(242, 181, 68, 0.06);
  pointer-events: none;
}

.metric strong {
  display: block;
  margin-top: 6px;
  color: var(--gold-bright);
  font-size: 1.18rem;
}

.error-text {
  margin: 12px 0 0;
  color: var(--bad);
  font-size: 0.84rem;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.action-row-destiny {
  grid-template-columns: 1fr;
  margin-top: 14px;
}

.action-button {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--text);
  font-weight: 800;
}

.ghost-button {
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--gold-bright);
  background: transparent;
  font-weight: 800;
}

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

.quick-button {
  display: grid;
  gap: 8px;
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.quick-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(242, 181, 68, 0.26);
  border-radius: 8px;
  color: var(--gold-bright);
  background: rgba(242, 181, 68, 0.08);
  font-size: 1.08rem;
}

.quick-button strong {
  display: block;
  color: var(--gold-bright);
  font-size: 0.92rem;
}

.quick-button span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.hour-card,
.result-card {
  padding: 11px;
  box-shadow: none;
}

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

.gender-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(36, 19, 19, 0.95);
  color: var(--text-soft);
  font-weight: 700;
}

.gender-button.active {
  color: var(--gold-bright);
  border-color: rgba(242, 181, 68, 0.45);
  background: linear-gradient(135deg, rgba(122, 31, 22, 0.9), rgba(54, 30, 27, 0.96));
}

.destiny-subject {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 14px;
}

.destiny-subject span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(242, 181, 68, 0.18);
  background: rgba(15, 7, 7, 0.3);
  color: var(--gold-bright);
  font-weight: 700;
  font-size: 0.84rem;
}

.destiny-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.destiny-flow-simple {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

.destiny-flow-simple .destiny-node {
  width: min(280px, 100%);
}

.destiny-node {
  min-height: 92px;
  padding: 14px 12px;
  border: 1px solid rgba(242, 181, 68, 0.15);
  border-radius: 14px;
  background: rgba(15, 7, 7, 0.26);
  text-align: center;
}

.destiny-node strong {
  display: block;
  margin-top: 6px;
  color: var(--gold-bright);
  font-size: 1.2rem;
}

.destiny-arrow {
  color: var(--gold);
  font-size: 1.4rem;
  font-weight: 800;
}

.destiny-result {
  margin-top: 16px;
  padding: 18px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 227, 170, 0.2);
  text-align: center;
}

.destiny-result-kicker {
  color: rgba(242, 232, 214, 0.8);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.destiny-result-icon {
  margin-top: 8px;
  font-size: 2.8rem;
}

.destiny-result-title {
  margin-top: 6px;
  color: #fff8ec;
  font-size: 1.85rem;
  font-weight: 800;
}

.tone-water {
  background: linear-gradient(135deg, rgba(34, 83, 120, 0.92), rgba(19, 41, 66, 0.96));
}

.tone-earth {
  background: linear-gradient(135deg, rgba(102, 71, 36, 0.94), rgba(62, 42, 20, 0.96));
}

.tone-wood {
  background: linear-gradient(135deg, rgba(41, 92, 47, 0.94), rgba(19, 54, 26, 0.96));
}

.tone-fire {
  background: linear-gradient(135deg, rgba(138, 46, 31, 0.95), rgba(82, 25, 18, 0.98));
}

.tone-metal {
  background: linear-gradient(135deg, rgba(94, 86, 67, 0.95), rgba(55, 49, 37, 0.98));
}

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

.legend-card {
  padding: 12px 10px;
  border: 1px solid rgba(242, 181, 68, 0.15);
  border-radius: 12px;
  background: rgba(15, 7, 7, 0.18);
  text-align: center;
}

.legend-icon {
  color: var(--gold-bright);
  font-size: 1.35rem;
}

.legend-title {
  margin-top: 6px;
  color: var(--gold-bright);
  font-size: 0.9rem;
  font-weight: 800;
}

.legend-copy {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.hour-card.good {
  border-color: rgba(242, 181, 68, 0.42);
  background: linear-gradient(180deg, rgba(45, 26, 26, 0.98), rgba(36, 19, 19, 0.96));
}

.hour-card.current {
  outline: 1px solid var(--primary);
  box-shadow: 0 0 0 4px rgba(228, 84, 58, 0.08);
}

.hour-name,
.result-title {
  color: var(--gold-bright);
  font-weight: 800;
}

.hour-name {
  margin-top: 6px;
  font-size: 1.15rem;
}

.hour-meta,
.result-desc {
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.4;
}

.result-title {
  font-size: 1.02rem;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 10px;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  width: min(980px, calc(100% - 16px));
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(26, 13, 13, 0.96);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.tab-button {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 58px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.tab-symbol {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: inherit;
  background: rgba(255, 227, 170, 0.04);
  font-size: 1rem;
  line-height: 1;
}

.tab-button.active {
  border-color: rgba(242, 181, 68, 0.42);
  color: var(--gold);
  background: rgba(242, 181, 68, 0.1);
}

.tab-button.active .tab-symbol {
  color: var(--surface-low);
  background: var(--gold);
}

@media (max-width: 760px) {
  .app-root {
    width: 100%;
    padding: 10px 10px 92px;
  }

  .app-header {
    min-height: 62px;
    padding-top: 8px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
  }

  .brand-name {
    font-size: 1.85rem;
  }

  .today-grid,
  .tool-grid,
  .result-grid,
  .hours-grid,
  .quick-grid,
  .field-grid,
  .legend-grid {
    grid-template-columns: 1fr;
  }

  .screen-art {
    width: 54px;
    height: 54px;
  }

  .screen-symbol {
    width: 36px;
    height: 36px;
  }

  .visual-row {
    align-items: center;
  }

  .card-visual {
    width: 82px;
    height: 82px;
    border-radius: 18px;
  }

  .visual-symbol {
    font-size: 2rem;
  }

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

  .destiny-flow {
    grid-template-columns: 1fr;
  }

  .destiny-arrow {
    transform: rotate(90deg);
    justify-self: center;
  }

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

  .screen-head h1 {
    font-size: 1.5rem;
  }

  .tabbar {
    width: calc(100% - 12px);
    bottom: 6px;
  }

  .tab-button {
    min-height: 56px;
  }
}

.visual-label {
  position: absolute;
  left: 50%;
  bottom: 11px;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .screen-head {
    align-items: flex-start;
  }

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

  .tab-button {
    font-size: 0.68rem;
  }
}
