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

:root {
  --bg: #f7efe6;
  --bg-soft: #fbf7f1;
  --panel: rgba(255, 253, 248, 0.94);
  --panel-strong: #fffdf8;
  --ink: #211a22;
  --muted: #6f6471;
  --line: #e8ddd1;
  --accent: #a96035;
  --accent-strong: #7a3f23;
  --teal: #006f73;
  --rose: #b24763;
  --gold: #c68a2b;
  --danger: #b43d4c;
  --success: #247554;
  --shadow: 0 18px 54px rgba(66, 43, 28, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 32px 18px;
  color: var(--ink);
  font-family: "Prompt", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(255, 250, 242, 0.92), rgba(238, 248, 246, 0.82)),
    repeating-linear-gradient(90deg, rgba(198, 138, 43, 0.08) 0 1px, transparent 1px 88px),
    var(--bg);
}

body.app-page {
  align-items: flex-start;
}

a {
  color: var(--accent-strong);
  font-weight: 600;
  text-decoration: none;
}

a:hover {
  color: var(--teal);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.15;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.45rem;
  line-height: 1.25;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
  line-height: 1.35;
}

p {
  color: var(--muted);
  line-height: 1.8;
}

hr {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

label {
  display: block;
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  margin-bottom: 18px;
  padding: 12px 14px;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #9a909c;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(0, 111, 115, 0.12);
}

button,
.btn {
  display: inline-flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  color: #fff;
  font: inherit;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  background: var(--accent-strong);
  border: 1px solid var(--accent-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

button:hover,
.btn:hover {
  color: #fff;
  background: #65321b;
  box-shadow: 0 12px 26px rgba(122, 63, 35, 0.18);
  transform: translateY(-1px);
}

button:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
  box-shadow: none;
}

.btn.secondary,
button.secondary {
  color: var(--accent-strong);
  background: #fff7ed;
  border-color: #e7c7a2;
}

.btn.secondary:hover,
button.secondary:hover {
  color: var(--ink);
  background: #ffefd8;
}

.btn.ghost,
button.ghost {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}

.btn.ghost:hover,
button.ghost:hover {
  color: var(--teal);
  background: rgba(0, 111, 115, 0.07);
}

.btn.danger,
button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

.center {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.container,
.card,
.fortune-card,
.mini-card,
.reading-card,
.chat-panel,
.admin-panel {
  background: var(--panel);
  border: 1px solid rgba(232, 221, 209, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.container {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: clamp(24px, 4vw, 40px);
}

.container.wide,
.daily-container {
  width: min(1080px, 100%);
}

.container.compact,
.card.login-card {
  width: min(480px, 100%);
}

.card {
  padding: clamp(22px, 4vw, 34px);
}

.site-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.home-shell {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 28px;
  align-items: center;
}

.home-copy {
  padding: clamp(10px, 3vw, 24px) 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--teal);
  font-size: 0.92rem;
  font-weight: 700;
}

.lead {
  max-width: 620px;
  margin-bottom: 26px;
  color: #564b58;
  font-size: 1.08rem;
}

.home-actions,
.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.home-visual {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  padding: 24px;
  color: #fffdf8;
  background:
    linear-gradient(150deg, rgba(33, 26, 34, 0.96), rgba(88, 55, 42, 0.9)),
    #211a22;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.home-visual::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(255, 253, 248, 0.18);
  border-radius: var(--radius);
  pointer-events: none;
}

.tarot-preview {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 26px;
}

.brand-mark,
.logo {
  font-size: 3.2rem;
  line-height: 1;
}

.logo {
  margin-bottom: 12px;
  text-align: center;
}

.preview-card-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
}

.preview-card {
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: #ffe1b4;
  font-size: 2.6rem;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.1), rgba(255, 253, 248, 0.02)),
    #2a202b;
  border: 1px solid rgba(255, 253, 248, 0.2);
  border-radius: var(--radius);
}

.preview-card:nth-child(2) {
  min-height: 310px;
  color: #9ae3de;
}

.preview-note {
  margin: 0;
  color: rgba(255, 253, 248, 0.78);
}

.subtitle {
  margin-bottom: 28px;
  color: var(--muted);
  text-align: center;
}

.auth-links {
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 18px;
  font-size: 0.95rem;
}

.helper-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
  text-align: left;
}

.text-center {
  text-align: center;
}

.mb-20 {
  margin-bottom: 20px;
}

.mt-20 {
  margin-top: 20px;
}

.hidden {
  display: none !important;
}

.status,
#msg,
#adminMsg,
#dailyStatus,
#profileMsg,
#callMsg,
#sheetConfigMsg {
  min-height: 28px;
  margin: 12px 0 0;
  color: var(--teal);
  font-weight: 600;
  text-align: center;
}

.status.error,
#msg.error,
#adminMsg.error,
#dailyStatus.error,
#profileMsg.error,
#callMsg.error,
#sheetConfigMsg.error {
  color: var(--danger);
}

.alert {
  padding: 14px 16px;
  color: #7c1f2a;
  background: #fff0f2;
  border: 1px solid #f2bcc5;
  border-radius: var(--radius);
}

.app-header,
.daily-header,
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-title .brand-mark,
.app-title .logo {
  margin: 0;
  font-size: 2.5rem;
}

.app-title p,
.page-header p,
.daily-header p {
  margin: 0;
}

.app-header > .btn,
.page-header > .btn {
  width: auto;
  min-width: 148px;
}

.profile {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 28px;
  padding: 18px;
  background: #fff7ed;
  border: 1px solid #ead4bd;
  border-radius: var(--radius);
}

.profile h2 {
  margin-bottom: 4px;
}

.profile p {
  margin: 0;
}

.badge,
.zodiac-badge {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  color: #3d2d11;
  font-weight: 700;
  background: #f6d28c;
  border: 1px solid #e1b567;
  border-radius: var(--radius);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 26px;
}

.menu-card {
  min-height: 136px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(66, 43, 28, 0.08);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.menu-card:hover {
  color: var(--ink);
  border-color: rgba(0, 111, 115, 0.35);
  box-shadow: 0 14px 28px rgba(0, 111, 115, 0.12);
  transform: translateY(-2px);
}

.menu-icon {
  font-size: 2rem;
  line-height: 1;
}

.menu-card span {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}

.menu-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 400;
  line-height: 1.6;
}

#logout {
  grid-column: 1 / -1;
  margin-top: 0;
}

.daily-container {
  margin: 0 auto;
}

.daily-header {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.daily-header h1 {
  margin-bottom: 4px;
}

.fortune-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.fortune-card {
  padding: 22px;
  margin-bottom: 14px;
}

.fortune-card h2 {
  color: var(--accent-strong);
}

.fortune-card p {
  margin: 0;
  color: #3f3542;
}

.fortune-card.warning {
  background: #fff7f8;
  border-color: #efc0c7;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.mini-card {
  padding: 22px;
  text-align: center;
}

.mini-card h3 {
  color: var(--teal);
}

.mini-card p {
  margin: 0;
  color: var(--ink);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.4;
}

.back-btn {
  display: inline-flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  color: var(--ink);
  font-weight: 700;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.back-btn:hover {
  color: var(--teal);
  background: rgba(0, 111, 115, 0.07);
}

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

.admin-grid .full,
.form-grid .full {
  grid-column: 1 / -1;
}

.account-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
}

.account-toolbar input {
  margin-bottom: 0;
}

.account-toolbar button {
  width: auto;
  min-width: 150px;
}

.account-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.account-card {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 320px);
  gap: 14px;
  align-items: center;
  padding: 16px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.account-card h3 {
  margin-bottom: 2px;
}

.account-card p,
.account-card small {
  display: block;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.account-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.account-actions select,
.account-actions button {
  margin: 0;
}

.reading-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.reading-card {
  min-height: 220px;
  padding: 20px;
}

.draw-result {
  display: grid;
  gap: 12px;
}

.tarot-summary {
  padding: 16px;
  background: #fff7ed;
  border: 1px solid #ead4bd;
  border-radius: var(--radius);
}

.tarot-summary h3 {
  color: var(--accent-strong);
}

.tarot-summary p {
  margin: 0;
  color: #3f3542;
}

.tarot-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  padding: 16px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tarot-face {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffe4bb;
  font-size: 2rem;
  background: #2a202b;
  border-radius: var(--radius);
}

.tarot-card h3 {
  margin-bottom: 2px;
}

.tarot-card .position {
  margin-bottom: 8px;
  color: var(--teal);
  font-size: 0.88rem;
  font-weight: 700;
}

.payment-panel {
  margin-top: 18px;
  padding: 16px;
  background: #fff7ed;
  border: 1px solid #e7c7a2;
  border-radius: var(--radius);
}

.payment-panel p {
  margin-bottom: 12px;
}

.qr-placeholder {
  width: min(180px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  gap: 4px;
  margin: 0 auto 14px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(33, 26, 34, 0.12) 50%, transparent 50%) 0 0 / 18px 18px,
    linear-gradient(rgba(33, 26, 34, 0.12) 50%, transparent 50%) 0 0 / 18px 18px,
    #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.qr-placeholder span,
.qr-placeholder strong {
  display: block;
  padding: 3px 8px;
  background: rgba(255, 253, 248, 0.9);
  border-radius: var(--radius);
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.76);
  border: 1px dashed #d7c7b6;
  border-radius: var(--radius);
  text-align: center;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-item {
  padding: 18px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.history-item time {
  display: block;
  margin-bottom: 8px;
  color: var(--teal);
  font-size: 0.9rem;
  font-weight: 700;
}

.history-item p {
  margin-bottom: 8px;
}

.chat-panel {
  overflow: hidden;
}

.chat-log {
  height: min(54vh, 520px);
  min-height: 360px;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 20px;
  background: #fffaf3;
  border-bottom: 1px solid var(--line);
}

.message {
  width: fit-content;
  max-width: min(560px, 86%);
  padding: 12px 14px;
  color: var(--ink);
  line-height: 1.7;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.message.user {
  justify-self: end;
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px;
}

.chat-form input {
  margin: 0;
}

.chat-form button {
  width: auto;
  min-width: 120px;
}

.profile-detail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.detail-box {
  padding: 14px;
  background: #fff7ed;
  border: 1px solid #ead4bd;
  border-radius: var(--radius);
}

.detail-box span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.detail-box strong {
  display: block;
  margin-top: 4px;
}

@media (max-width: 900px) {
  body {
    padding: 24px 14px;
  }

  .home-shell,
  .reading-layout {
    grid-template-columns: 1fr;
  }

  .home-visual {
    min-height: 360px;
  }

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

@media (max-width: 640px) {
  body {
    padding: 16px 10px;
  }

  .container,
  .card,
  .daily-header,
  .fortune-card,
  .mini-card,
  .reading-card {
    padding: 18px;
  }

  .home-actions,
  .button-row,
  .menu-grid,
  .fortune-grid,
  .mini-grid,
  .admin-grid,
  .form-grid,
  .profile,
  .profile-detail,
  .account-toolbar,
  .account-card {
    grid-template-columns: 1fr;
  }

  .app-header,
  .daily-header,
  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-header > .btn,
  .page-header > .btn,
  .account-toolbar button {
    width: 100%;
  }

  .preview-card-stack {
    grid-template-columns: repeat(3, minmax(76px, 1fr));
  }

  .preview-card {
    min-height: 178px;
  }

  .preview-card:nth-child(2) {
    min-height: 218px;
  }

  .tarot-card {
    grid-template-columns: 1fr;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .chat-form button {
    width: 100%;
  }
}
