/* =========================================
   こん おみくじ — style.css
   世界観：古風・和・ぬくもり・狐／LIFF Full想定
   ========================================= */

:root {
  --bg: #fff6ea;
  --bg-deep: #f5e6cf;
  --paper: #fffaf2;
  --ink: #3a2418;
  --ink-soft: #6b4a36;
  --accent: #e85a1a;      /* こんのオレンジ */
  --accent-deep: #b8410e;
  --gold: #c89a3a;
  --shadow: 0 8px 24px rgba(58, 36, 24, 0.12);
  --shadow-soft: 0 2px 8px rgba(58, 36, 24, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: contain;
}

body {
  background:
    radial-gradient(circle at 20% 10%, rgba(232, 90, 26, 0.06), transparent 50%),
    radial-gradient(circle at 80% 90%, rgba(200, 154, 58, 0.08), transparent 50%),
    var(--bg);
}

.app {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
}

/* ========= 画面切替 ========= */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px 20px 32px;
  animation: fadeIn 0.35s ease both;
}
.screen--active { display: flex; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========= LOADING ========= */
.loader {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  color: var(--ink-soft);
}
.loader__spin {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(184, 65, 14, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader__text { font-size: 14px; letter-spacing: 0.1em; }

/* ========= 共通カード ========= */
.card {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border-radius: 22px;
  padding: 30px 24px 28px;
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid rgba(200, 154, 58, 0.25);
  position: relative;
}
.card::before, .card::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 16px;
  border: 1px dashed rgba(184, 65, 14, 0.18);
  pointer-events: none;
}
.card::after { inset: 10px; border: none; }

.card__lantern {
  font-size: 28px;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 4px rgba(232,90,26,0.3));
}
.card__greeting {
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  margin: 0 0 8px;
}
.card__chara {
  width: 140px; height: auto;
  margin: 6px 0 4px;
  filter: drop-shadow(0 4px 10px rgba(58,36,24,0.18));
  animation: bob 3.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.card__title {
  font-size: 26px; line-height: 1.35; margin: 8px 0 6px;
  color: var(--ink); font-weight: 700; letter-spacing: 0.04em;
}
.card__sub {
  font-size: 14px; line-height: 1.8; color: var(--ink-soft); margin: 0 0 22px;
}
.card__note {
  font-size: 11px; color: var(--ink-soft); opacity: 0.7;
  margin: 14px 0 0; line-height: 1.6;
}

/* ========= ボタン ========= */
.btn {
  border: none; outline: none;
  width: 100%; padding: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease, opacity 0.15s ease;
  -webkit-appearance: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn__inner {
  display: block;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: 999px;
}

.btn--primary .btn__inner {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(232,90,26,0.35);
}
.btn--ghost .btn__inner {
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px solid rgba(107, 74, 54, 0.3);
}

/* ========= DRAWING ========= */
.drawing { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.drawing__box {
  display: flex; flex-direction: column; align-items: center; gap: 24px;
}
.drawing__shake img {
  width: 160px; height: auto;
  animation: shake 0.5s ease-in-out infinite;
  filter: drop-shadow(0 6px 14px rgba(232,90,26,0.3));
}
@keyframes shake {
  0%, 100% { transform: rotate(-6deg) translateY(0); }
  50%      { transform: rotate(6deg)  translateY(-4px); }
}
.drawing__text {
  font-size: 16px; color: var(--ink-soft); letter-spacing: 0.12em;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.4; } }

/* ========= RESULT ========= */
.result {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border-radius: 22px;
  padding: 32px 26px 28px;
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid rgba(200, 154, 58, 0.3);
  position: relative;
  animation: revealUp 0.7s cubic-bezier(0.2, 0.8, 0.3, 1.1) both;
}
@keyframes revealUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.result__label {
  font-size: 12px; color: var(--ink-soft);
  letter-spacing: 0.3em; margin: 0 0 14px;
}
.result__fortune {
  font-size: 56px; font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  line-height: 1.1;
  margin: 0 0 8px;
  text-shadow: 0 2px 0 rgba(232,90,26,0.15);
  animation: stamp 0.5s ease 0.3s both;
}
.result__fortune.is-rare { color: var(--gold); }
.result__fortune.is-bad { color: #5a5040; }
@keyframes stamp {
  from { transform: scale(1.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.result__date {
  font-size: 12px; color: var(--ink-soft);
  margin: 0 0 16px; letter-spacing: 0.1em;
}
.result__divider {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin: 14px 0 18px;
}
.result__divider span:first-child,
.result__divider span:last-child {
  flex: 1; height: 1px; background: rgba(200, 154, 58, 0.4);
}
.result__dot { color: var(--gold); font-size: 14px; }

.result__message {
  font-size: 17px; line-height: 2; color: var(--ink);
  margin: 0 0 16px; letter-spacing: 0.05em;
  white-space: pre-line;
}
.result__sign {
  font-size: 13px; color: var(--ink-soft);
  margin: 0 0 24px; letter-spacing: 0.2em;
}

.result__actions {
  display: flex; flex-direction: column; gap: 10px;
}
.result__status {
  font-size: 12px; color: var(--ink-soft); margin: 14px 0 0;
  min-height: 1em;
}
.result__status.is-ok { color: #2c8a4a; }
.result__status.is-ng { color: var(--accent-deep); }

/* ========= ALREADY ========= */
.already {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  border-radius: 22px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid rgba(200, 154, 58, 0.25);
}
.already__chara {
  width: 100px; height: auto;
  margin: 0 0 10px;
}
.already__voice {
  font-size: 16px; color: var(--ink); margin: 0 0 22px;
  line-height: 1.8;
}
.already__recap {
  background: rgba(245, 230, 207, 0.5);
  border-radius: 14px;
  padding: 18px 16px;
  margin: 0 0 20px;
}
.already__recap-label {
  font-size: 11px; color: var(--ink-soft);
  letter-spacing: 0.25em; margin: 0 0 6px;
}
.already__recap-fortune {
  font-size: 28px; font-weight: 700;
  color: var(--accent); margin: 0 0 8px;
  letter-spacing: 0.1em;
}
.already__recap-message {
  font-size: 14px; line-height: 1.8;
  color: var(--ink); margin: 0;
  white-space: pre-line;
}

/* ========= ERROR ========= */
.error { text-align: center; max-width: 320px; }
.error__title {
  font-size: 20px; color: var(--ink); margin: 0 0 12px;
}
.error__body {
  font-size: 14px; color: var(--ink-soft); line-height: 1.7; margin: 0 0 24px;
}
