:root {
  color-scheme: dark;
  --bg: #0b0c10;
  --surface: #111318;
  --surface-2: #171a21;
  --surface-3: #20242d;
  --line: #2e3440;
  --line-soft: rgba(255, 255, 255, .08);
  --text: #f2eee7;
  --muted: #a9a69f;
  --faint: #777b82;
  --gold: #c9a45c;
  --gold-2: #f0cc7a;
  --teal: #5fb2a3;
  --red: #b7645c;
  --shadow: 0 24px 70px rgba(0, 0, 0, .35);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(95, 178, 163, .08), transparent 28%),
    linear-gradient(180deg, #111318 0%, #0b0c10 48%, #07080b 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .68;
}

.phone-shell {
  min-height: 100vh;
  background: var(--surface);
}

.app-header {
  padding: 28px 18px 18px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-decor {
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 3px;
  background: rgba(255, 255, 255, .03);
  flex: 0 0 auto;
}

.lang-switch button {
  height: 28px;
  min-width: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.lang-switch button.active {
  background: rgba(240, 204, 122, .14);
  color: var(--gold-2);
}

.app-header h1 {
  margin: 9px 0 0;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.app-header p {
  max-width: 560px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.page-stack {
  padding: 0 14px 86px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.hidden {
  display: none !important;
}

.date-card,
.reading-panel,
.history-card,
.profile-hero,
.menu-list button,
.stats-grid > div,
.question-box,
.tarot-card-view,
.spread-card,
.mini-card,
.daily-empty,
.search-bar,
.divination-output {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-2);
}

.date-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 12px;
}

.date-card em {
  color: var(--gold);
  font-style: normal;
}

.daily-empty {
  min-height: 430px;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 16px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .05), rgba(0, 0, 0, .48)),
    url("https://assets.untilzero.top/tarot/cards/02-the-high-priestess.jpg") center 18px / 230px auto no-repeat,
    #12151c;
}

.mystic-orb {
  display: inline-flex;
  width: max-content;
}

.ring {
  display: none;
}

.mystic-orb span {
  border: 1px solid rgba(240, 204, 122, .28);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--gold-2);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
}

.daily-empty h2 {
  margin: 0;
  max-width: 320px;
  font-size: 27px;
  line-height: 1.1;
  letter-spacing: 0;
}

.daily-empty p,
.daily-empty small,
.intro-text,
.card-en,
.keywords,
.meaning,
.history-list,
.profile-hero p {
  color: var(--muted);
}

.daily-empty p {
  max-width: 330px;
  margin: 0;
  line-height: 1.7;
}

.daily-empty small {
  font-size: 12px;
}

.gold-btn,
.ghost-btn {
  height: 48px;
  border-radius: 8px;
  font-weight: 800;
}

.gold-btn {
  min-width: 188px;
  padding: 0 18px;
  border: 1px solid rgba(240, 204, 122, .55);
  background: var(--gold);
  color: #111318;
  box-shadow: 0 12px 30px rgba(201, 164, 92, .18);
}

.gold-btn:hover {
  background: var(--gold-2);
}

.gold-btn.full {
  width: 100%;
  margin: 14px 0;
}

.ghost-btn {
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text);
}

.large-card-wrap {
  display: flex;
  justify-content: center;
}

.large-card-wrap .tarot-card-view {
  width: 100%;
}

.tarot-card-view {
  overflow: hidden;
}

.card-img-frame {
  height: 360px;
  display: grid;
  place-items: center;
  background: #08090c;
  overflow: hidden;
}

.card-img-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-info {
  padding: 14px;
}

.card-info h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.card-en {
  margin: 5px 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-en:empty {
  display: none;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.tag-row span {
  padding: 5px 9px;
  border: 1px solid rgba(201, 164, 92, .28);
  border-radius: 999px;
  background: rgba(201, 164, 92, .08);
  color: var(--gold-2);
  font-size: 12px;
}

.keywords {
  margin: 0 0 10px;
  font-size: 13px;
}

.meaning {
  margin: 0;
  line-height: 1.75;
  font-size: 14px;
}

.reading-panel {
  margin-top: 16px;
  padding: 16px;
  color: #ded8ce;
  font-size: 14px;
  line-height: 1.85;
}

.reading-panel p {
  margin: 0 0 12px;
}

.reading-panel p:last-child {
  margin-bottom: 0;
}

.inline-error {
  margin: 0;
  color: #ffb86c;
  font-size: 13px;
  line-height: 1.6;
}

.typing {
  color: var(--gold-2);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 12px;
}

.section-title.compact {
  margin-top: 0;
}

.section-title span {
  min-width: 27px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.section-title h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.intro-text {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.7;
}

.divination-workspace {
  display: grid;
  gap: 16px;
}

.divination-form,
.divination-output {
  min-width: 0;
}

.divination-output {
  padding: 14px;
}

.output-title {
  margin-bottom: 12px;
}

.spread-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 5px;
}

.spread-card {
  width: 162px;
  min-height: 156px;
  padding: 14px;
  flex: 0 0 auto;
  color: inherit;
  text-align: left;
}

.spread-card.selected {
  border-color: rgba(240, 204, 122, .55);
  background: #1d2027;
}

.spread-preview {
  position: relative;
  height: 52px;
  margin-bottom: 12px;
}

.preview-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 31px;
  border: 1px solid rgba(240, 204, 122, .62);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(240, 204, 122, .22), rgba(95, 178, 163, .08)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .08) 0 1px, transparent 1px 5px),
    #151923;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .24);
  transform: translate(-50%, -50%);
}

.preview-card::after {
  content: "";
  position: absolute;
  inset: 6px 5px;
  border: 1px solid rgba(240, 204, 122, .34);
  border-radius: 50%;
}

.spread-preview-yes_no .preview-card-1 {
  width: 25px;
  height: 38px;
}

.spread-preview-three_card .preview-card-1 { transform: translate(-175%, -50%) rotate(-8deg); }
.spread-preview-three_card .preview-card-2 { transform: translate(-50%, -50%); }
.spread-preview-three_card .preview-card-3 { transform: translate(75%, -50%) rotate(8deg); }

.spread-preview-holy_triangle .preview-card-1 { transform: translate(-50%, -88%); }
.spread-preview-holy_triangle .preview-card-2 { transform: translate(-130%, -8%) rotate(-7deg); }
.spread-preview-holy_triangle .preview-card-3 { transform: translate(30%, -8%) rotate(7deg); }

.spread-preview-love .preview-card-1 { transform: translate(-170%, -58%) rotate(-8deg); }
.spread-preview-love .preview-card-2 { transform: translate(70%, -58%) rotate(8deg); }
.spread-preview-love .preview-card-3 { transform: translate(-50%, -50%); }
.spread-preview-love .preview-card-4 { transform: translate(-110%, 5%) rotate(-5deg); }
.spread-preview-love .preview-card-5 { transform: translate(10%, 5%) rotate(5deg); }

.spread-preview-horseshoe .preview-card-1 { transform: translate(-215%, -10%) rotate(-24deg); }
.spread-preview-horseshoe .preview-card-2 { transform: translate(-155%, -52%) rotate(-16deg); }
.spread-preview-horseshoe .preview-card-3 { transform: translate(-85%, -76%) rotate(-8deg); }
.spread-preview-horseshoe .preview-card-4 { transform: translate(-15%, -82%); }
.spread-preview-horseshoe .preview-card-5 { transform: translate(55%, -76%) rotate(8deg); }
.spread-preview-horseshoe .preview-card-6 { transform: translate(125%, -52%) rotate(16deg); }
.spread-preview-horseshoe .preview-card-7 { transform: translate(185%, -10%) rotate(24deg); }

.spread-card.selected .preview-card {
  border-color: var(--gold-2);
  background:
    linear-gradient(135deg, rgba(240, 204, 122, .38), rgba(95, 178, 163, .14)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .1) 0 1px, transparent 1px 5px),
    #1b202a;
}

.spread-card h3 {
  margin: 0;
  font-size: 15px;
}

.spread-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.template-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
}

.template-list button {
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  flex: 0 0 auto;
}

.question-box {
  display: block;
  padding: 14px;
}

.question-box span {
  display: block;
  margin-bottom: 9px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  min-height: 108px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  resize: vertical;
}

textarea::placeholder,
input::placeholder {
  color: var(--faint);
}

.question-box em {
  display: block;
  color: var(--faint);
  font-size: 12px;
  font-style: normal;
  text-align: right;
}

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

.mini-card {
  overflow: hidden;
}

.mini-card img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  background: #08090c;
}

.mini-card strong,
.mini-card span {
  display: block;
  padding: 0 8px;
}

.mini-card strong {
  margin-top: 8px;
  font-size: 13px;
}

.mini-card span {
  margin: 4px 0 10px;
  color: var(--gold-2);
  font-size: 12px;
}

.search-bar {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}

.search-bar span {
  color: var(--gold);
}

.search-bar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-tabs button {
  height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.filter-tabs button.active {
  border-color: rgba(240, 204, 122, .52);
  color: var(--gold-2);
}

.results-info {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

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

.library-grid .tarot-card-view {
  height: 100%;
  display: grid;
  grid-template-rows: 220px 150px;
}

.library-grid .card-img-frame {
  height: 220px;
}

.library-grid .card-info {
  min-width: 0;
  overflow: hidden;
}

.library-grid .meaning {
  display: none;
}

.library-grid .card-info h3 {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-grid .card-en {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-grid .tag-row {
  flex-wrap: nowrap;
  overflow: hidden;
}

.library-grid .tag-row span {
  white-space: nowrap;
}

.library-grid .keywords {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin-bottom: 12px;
}

.avatar-orb {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(240, 204, 122, .35);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--gold-2);
  font-size: 14px;
  font-weight: 900;
  flex: 0 0 auto;
}

.profile-hero h2 {
  margin: 0;
  font-size: 22px;
}

.profile-hero p {
  margin: 6px 0 0;
  font-size: 13px;
}

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

.stats-grid > div {
  min-height: 82px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 12px;
}

.stats-grid strong {
  color: var(--gold-2);
  font-size: 24px;
}

.stats-grid span {
  color: var(--muted);
  font-size: 12px;
}

.menu-list {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.menu-list button {
  width: 100%;
  min-height: 70px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-align: left;
}

.menu-list i {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--gold-2);
  font-style: normal;
  flex: 0 0 auto;
}

.menu-list span {
  flex: 1;
}

.menu-list strong,
.menu-list em {
  display: block;
}

.menu-list em {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.menu-list b {
  color: var(--faint);
  font-size: 24px;
}

.history-card {
  padding: 16px;
}

.history-list {
  display: grid;
  gap: 10px;
  font-size: 13px;
}

.history-item {
  width: 100%;
  border-top: 1px solid var(--line-soft);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  padding-top: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  line-height: 1.55;
}

.history-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.history-item strong {
  color: var(--text);
}

.history-item:hover strong {
  color: var(--gold-2);
}

.history-item small {
  color: var(--faint);
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  height: 68px;
  border-top: 1px solid var(--line-soft);
  background: rgba(12, 13, 17, .94);
  backdrop-filter: blur(18px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar button {
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.tabbar button.active {
  color: var(--gold-2);
}

.tabbar span {
  font-size: 12px;
  font-weight: 900;
}

.tabbar em {
  font-size: 11px;
  font-style: normal;
}

.desktop-brand {
  display: none;
}

.seo-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 18px 16px 92px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.seo-footer-links a {
  color: inherit;
  text-decoration: none;
}

.seo-footer-links a:hover {
  color: var(--gold-2);
}

@media (min-width: 720px) {
  .page-stack {
    padding-left: 24px;
    padding-right: 24px;
  }

  .app-header {
    padding-left: 24px;
    padding-right: 24px;
  }

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

@media (min-width: 960px) {
  body {
    padding: 24px;
  }

  .phone-shell {
    min-height: calc(100vh - 48px);
    display: grid;
    grid-template-columns: 244px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(17, 19, 24, .9);
    box-shadow: var(--shadow);
  }

  .app-header {
    grid-column: 2;
    padding: 38px 42px 20px;
  }

  .app-header h1 {
    font-size: 46px;
  }

  .app-header p {
    font-size: 15px;
  }

  .page-stack {
    grid-column: 2;
    min-width: 0;
    padding: 0 42px 42px;
  }

  .tabbar {
    position: static;
    grid-column: 1;
    grid-row: 1 / span 2;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 28px 16px;
    border-top: 0;
    border-right: 1px solid var(--line-soft);
    background: #0d0f14;
    backdrop-filter: none;
  }

  .desktop-brand {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 10px 24px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--line-soft);
  }

  .desktop-brand span {
    width: 48px;
    height: 48px;
    border: 1px solid rgba(240, 204, 122, .35);
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--gold-2);
    font-weight: 900;
  }

  .desktop-brand strong {
    font-size: 20px;
    line-height: 1.15;
  }

  .desktop-brand em {
    color: var(--gold);
    font-size: 10px;
    font-style: normal;
    font-weight: 900;
    letter-spacing: 1.3px;
  }

  .tabbar button {
    min-height: 50px;
    border: 1px solid transparent;
    border-radius: 8px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 12px;
  }

  .tabbar button.active {
    border-color: rgba(240, 204, 122, .24);
    background: rgba(240, 204, 122, .08);
  }

  .tabbar span {
    width: 24px;
    text-align: center;
  }

  .tabbar em {
    font-size: 14px;
    font-weight: 750;
  }

  .date-card {
    margin-bottom: 18px;
  }

  .daily-empty {
    min-height: 580px;
    padding: 42px;
    background:
      linear-gradient(90deg, rgba(18, 21, 28, .96) 0%, rgba(18, 21, 28, .84) 45%, rgba(18, 21, 28, .24) 100%),
      url("https://assets.untilzero.top/tarot/cards/02-the-high-priestess.jpg") right 8% center / 360px auto no-repeat,
      #12151c;
  }

  .daily-empty h2 {
    max-width: 420px;
    font-size: 42px;
  }

  .daily-empty p {
    max-width: 430px;
    font-size: 16px;
  }

  .daily-drawn {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 18px;
    align-items: start;
  }

  .daily-drawn .large-card-wrap {
    grid-row: 1 / span 2;
  }

  .daily-drawn .reading-panel {
    min-height: 360px;
    margin-top: 0;
  }

  .daily-drawn .ghost-btn {
    width: 190px;
    justify-self: start;
  }

  .card-img-frame {
    height: 500px;
  }

  .spread-scroll {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
    overflow: visible;
  }

  .spread-card {
    width: auto;
    min-height: 176px;
  }

  .question-box {
    padding: 18px;
  }

  textarea {
    min-height: 132px;
  }

  .gold-btn.full {
    width: 220px;
  }

  .spread-result {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    margin-top: 8px;
  }

  .mini-card img {
    height: 205px;
  }

  .reading-panel {
    padding: 22px;
    font-size: 15px;
  }

  .search-bar {
    max-width: 640px;
  }

  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
  }

  .library-grid .card-img-frame {
    height: 300px;
  }

  .library-grid .tarot-card-view {
    grid-template-rows: 300px 154px;
  }

  .profile-hero {
    padding: 22px;
  }

  .profile-hero h2 {
    font-size: 30px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 200px));
  }

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

  .history-card {
    padding: 22px;
  }
}

@media (min-width: 1200px) {
  .page[data-page="profile"].active {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .85fr);
    gap: 20px;
    align-items: start;
  }

  .page[data-page="divination"].active {
    display: block;
  }

  .divination-workspace {
    grid-template-columns: minmax(0, 1.32fr) minmax(340px, .78fr);
    gap: 22px;
    align-items: start;
  }

  .divination-output {
    position: sticky;
    top: 24px;
    padding: 18px;
  }

  .divination-output .reading-panel {
    margin-top: 14px;
  }

  .page[data-page="profile"].active .stats-grid {
    grid-column: 1;
  }

  .page[data-page="profile"].active .history-card {
    grid-column: 2;
    grid-row: 1;
  }
}
