@import url("https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700;800&display=swap");

:root {
  --portal-ink: #2f281e;
  --portal-muted: #756a59;
  --portal-gold: #c79827;
  --portal-gold-dark: #8c6209;
  --portal-cream: #f7f0df;
  --portal-paper: rgba(255, 255, 255, 0.9);
  --portal-line: rgba(125, 96, 39, 0.18);
  --portal-shadow: 0 18px 44px rgba(82, 60, 23, 0.12);
}

* { box-sizing: border-box; }

.portal-body {
  min-height: 100vh;
  margin: 0;
  color: var(--portal-ink);
  font-family: "Kanit", sans-serif;
  background:
    radial-gradient(circle at 50% -12%, rgba(225, 183, 76, 0.2), transparent 34rem),
    linear-gradient(135deg, #fbf7ec 0%, #f4ecd9 54%, #f8f1e3 100%);
}

.portal-app {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 18px 112px;
}

.portal-topbar {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.circle-button {
  display: flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #ede3ce;
  border-radius: 9999px;
  color: var(--portal-ink);
  background: #fff;
  box-shadow: 0 2px 6px rgba(80, 55, 10, 0.06), 0 12px 30px -12px rgba(90, 62, 12, 0.16);
  text-decoration: none;
}

.circle-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 1.08rem;
}

.topbar-title span { color: var(--portal-gold); }
.mini-logo { width: 36px; height: 36px; justify-self: end; border-radius: 12px; object-fit: cover; }

.portal-intro { padding: 8px 4px 20px; }
.portal-intro h1 { margin: 5px 0 6px; font-size: clamp(1.65rem, 7vw, 2.2rem); line-height: 1.22; }
.portal-intro p { margin: 0; color: var(--portal-muted); line-height: 1.65; }
.portal-kicker { color: var(--portal-gold-dark); font-size: 0.77rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }

.service-group,
.draft-surface {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 26px;
  background: var(--portal-paper);
  box-shadow: var(--portal-shadow);
  backdrop-filter: blur(12px);
}

.featured-group { border-color: rgba(194, 146, 36, 0.26); background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(255,248,226,.92)); }
.group-heading { display: grid; grid-template-columns: 28px 1fr; gap: 8px; margin-bottom: 13px; }
.group-icon { color: var(--portal-gold); font-size: 1.25rem; }
.group-heading h2, .section-title h2 { margin: 0; font-size: 1.06rem; }
.group-heading p { margin: 2px 0 0; color: var(--portal-muted); font-size: 0.82rem; line-height: 1.45; }

.service-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--portal-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
}
.service-card + .service-card { margin-top: 10px; }
.service-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 14px; color: var(--portal-gold-dark); background: linear-gradient(145deg, #fff4cc, #f5dfaa); font-size: 1.25rem; }
.service-copy h3 { margin: 3px 0 2px; font-size: 1rem; line-height: 1.35; }
.service-copy p { margin: 0; color: var(--portal-muted); font-size: 0.82rem; line-height: 1.5; }
.service-card .gold-button, .service-card .muted-button { grid-column: 1 / -1; }
.compact-card { align-items: center; }
.live-pill, .draft-pill { display: inline-flex; width: fit-content; padding: 3px 8px; border-radius: 99px; font-size: 0.68rem; font-weight: 800; }
.live-pill { color: #725006; background: #fff0b7; }
.draft-pill { color: #655e55; background: #eee9e0; }

.gold-button,
.muted-button {
  display: grid;
  width: 100%;
  min-height: 42px;
  place-items: center;
  margin-top: 10px;
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  font: inherit;
  font-weight: 800;
}
.gold-button { color: #3b2a04; background: linear-gradient(180deg, #f6d66e, #d6a817); box-shadow: 0 8px 16px rgba(182, 133, 13, 0.22); }
.muted-button { color: #7d7466; background: #eee9e1; }
.muted-button.full { margin-top: 14px; }

.portal-bottom-nav {
  position: fixed;
  z-index: 1000;
  right: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(calc(100% - 28px), 380px);
  min-height: 62px;
  padding: 5px 7px;
  border: 1px solid rgba(128, 110, 76, 0.12);
  border-radius: 31px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 30px rgba(77, 58, 26, 0.14);
  backdrop-filter: blur(20px);
  transform: translateX(50%);
}
.portal-bottom-nav a {
  display: grid;
  min-width: 0;
  min-height: 50px;
  gap: 1px;
  place-items: center;
  align-content: center;
  padding: 5px 2px;
  border-radius: 23px;
  color: #625d53;
  text-decoration: none;
  transition: color .2s ease, background .2s ease, transform .2s ease;
}
.portal-bottom-nav a svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.portal-bottom-nav a small { font-size: 0.68rem; line-height: 1; white-space: nowrap; }
.portal-bottom-nav a.active {
  color: #fffdf5;
  background: linear-gradient(180deg, #d5aa24, #b98708);
  box-shadow: 0 6px 14px rgba(168, 119, 5, 0.28);
  transform: translateY(-1px);
}
.portal-bottom-nav a.active svg { stroke-width: 1.8; }

.brand-header { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-header img { width: 50px; height: 50px; border-radius: 16px; box-shadow: 0 8px 18px rgba(59, 34, 50, .2); }
.brand-header div { display: grid; gap: 2px; }
.brand-header strong { font-size: 1.08rem; }
.brand-header span, .brand-header time { color: var(--portal-muted); font-size: 0.78rem; }
.daily-hero { position: relative; overflow: hidden; min-height: 250px; background: linear-gradient(145deg, #fffdf8, #f8e7b9); }
.daily-hero::after { content: "✦"; position: absolute; right: -18px; bottom: -58px; color: rgba(179, 128, 17, .12); font-size: 12rem; }
.daily-hero h1 { width: 70%; margin: 8px 0; font-size: 1.85rem; line-height: 1.25; }
.daily-hero > .draft-pill { position: absolute; top: 16px; right: 16px; }
.energy-orb { position: absolute; right: 22px; bottom: 22px; display: grid; width: 112px; height: 112px; place-items: center; border: 1px solid rgba(169, 115, 8, .22); border-radius: 50%; color: #7b5307; background: radial-gradient(circle, #fffdf6 0 35%, #f3d474 100%); box-shadow: 0 13px 30px rgba(143, 101, 12, .2); font-size: 2.1rem; font-weight: 900; }
.energy-orb small { margin-top: -30px; font-size: .64rem; font-weight: 700; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.time-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.time-grid span { display: grid; gap: 3px; padding: 12px; border-radius: 14px; background: #f5f1e8; font-size: .84rem; font-weight: 800; }
.time-grid small { color: var(--portal-muted); font-weight: 500; }
.time-grid .good { color: #6f4f08; background: #fff0bd; }
.quick-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick-links a { display: grid; min-height: 112px; place-items: center; align-content: center; gap: 4px; padding: 10px 5px; border: 1px solid var(--portal-line); border-radius: 16px; color: var(--portal-gold-dark); background: #fff; text-decoration: none; font-size: 1.3rem; }
.quick-links strong { color: var(--portal-ink); font-size: .77rem; }
.quick-links small { color: var(--portal-muted); font-size: .64rem; }
.lucky-placeholder { padding: 22px 8px; border-radius: 18px; text-align: center; color: #8f680c; background: linear-gradient(145deg, #fff8df, #f4e2ad); font-size: 1.5rem; font-weight: 900; letter-spacing: .08em; }
.center-note { margin: 10px 0 0; text-align: center; color: var(--portal-muted); font-size: .76rem; }

.chat-page { display: flex; flex-direction: column; }
.chat-welcome { display: grid; grid-template-columns: 50px 1fr; gap: 12px; align-items: start; padding: 18px; border-radius: 22px; background: rgba(255,255,255,.88); box-shadow: var(--portal-shadow); }
.chat-welcome p { margin: 0; line-height: 1.7; }
.oracle-avatar, .profile-orb { display: grid; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(145deg, #caa33d, #6b3752); }
.oracle-avatar { width: 48px; height: 48px; }
.question-chips { display: grid; gap: 9px; margin: 18px 0; }
.question-chips button { padding: 13px 15px; border: 1px solid var(--portal-line); border-radius: 16px; color: var(--portal-ink); background: rgba(255,255,255,.82); text-align: left; font: inherit; }
.chat-composer { margin-top: auto; padding: 14px; border-radius: 22px; background: #fff; box-shadow: var(--portal-shadow); }
.chat-composer textarea { width: 100%; min-height: 95px; resize: none; padding: 12px; border: 1px solid var(--portal-line); border-radius: 14px; font: inherit; }
.chat-composer button { width: 100%; margin-top: 8px; padding: 12px; border: 0; border-radius: 14px; color: #796e5e; background: #ece7de; font: inherit; font-weight: 800; }
.chat-composer small { display: block; margin-top: 8px; color: var(--portal-muted); text-align: center; }

.profile-hero { text-align: center; }
.profile-orb { width: 76px; height: 76px; margin: 0 auto 12px; font-size: 2rem; }
.profile-hero h1 { margin: 8px 0 4px; }
.profile-hero p { margin: 0; color: var(--portal-muted); line-height: 1.6; }
.feature-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.feature-list li { padding: 11px 12px; border-radius: 13px; background: #f6f1e8; }
.feature-list li::before { content: "✦"; margin-right: 8px; color: var(--portal-gold); }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; padding: 10px; }
.legal-links a { color: var(--portal-muted); font-size: .76rem; }
.legal-page { margin-top: 40px; }

.portal-tarot-body { padding-bottom: 104px; }
.tarot-portal-header { position: relative; z-index: 3; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; width: min(calc(100% - 28px), 1296px); margin: 16px auto 0; }
.tarot-portal-header > div { display: flex; justify-content: center; gap: 8px; color: #fff; }
.tarot-portal-header > div span { color: #efc762; }
.tarot-portal-header .circle-button { color: #fff; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.15); }
.tarot-portal-content { padding-top: 20px; }
.portal-tarot-body .portal-bottom-nav { color: var(--portal-ink); font-family: "Kanit", sans-serif; }

@media (min-width: 800px) {
  .portal-body::before, .portal-body::after { content: "✦"; position: fixed; color: rgba(167, 119, 18, .08); font-size: 22rem; pointer-events: none; }
  .portal-body::before { left: -7rem; top: 4rem; }
  .portal-body::after { right: -7rem; bottom: -5rem; }
}

@media (max-width: 520px) {
  .portal-app { padding-inline: 12px; }
  .service-group, .draft-surface { padding: 15px; border-radius: 22px; }
  .portal-bottom-nav { bottom: max(7px, env(safe-area-inset-bottom)); width: calc(100% - 18px); }
  .portal-bottom-nav a small { font-size: .62rem; }
  .daily-hero h1 { width: 78%; font-size: 1.55rem; }
  .energy-orb { width: 96px; height: 96px; right: 16px; font-size: 1.75rem; }
}
