:root {
  --bg-dark: #0f0505;
  --bg-panel: #1a0a0a;
  --primary: #dc2626; /* Red */
  --primary-dark: #991b1b;
  --accent: #fbbf24; /* Gold */
  --text: #fff1f2;
  --text-muted: #fda4af;
  --border: rgba(251, 191, 36, 0.2);
  --card: rgba(26, 10, 10, 0.8);
  --bg-image: radial-gradient(circle at 50% 0%, #450a0a, transparent 60%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23fbbf24' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  --shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.8);
  --radius: 1rem;
  --font-main: 'Noto Serif JP', 'Inter', serif;
  --transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  --input-bg: rgba(0, 0, 0, 0.3);
  --action-bg: rgba(255, 255, 255, 0.1);
  --pill-bg: rgba(255, 255, 255, 0.05);
  --pill-border: rgba(255, 255, 255, 0.1);
  --box-body: #7f1d1d;
  --box-lid: #991b1b;
  --box-border: #fbbf24;
  --box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  --button-shadow: 0 10px 20px rgba(220, 38, 38, 0.3);
  --button-shadow-hover: 0 15px 30px rgba(220, 38, 38, 0.4);
  --paper-bg: #fff;
  --paper-text: #1a0a0a;
  --paper-border: #dc2626;
  --paper-divider: #ccc;
  --detail-label: #7f1d1d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  background-image: var(--bg-image);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body[data-theme="light"] {
  --bg-dark: #fff6ec;
  --bg-panel: #fff1e5;
  --card: rgba(255, 255, 255, 0.85);
  --text: #3a1b1b;
  --text-muted: #7a3d3d;
  --border: rgba(220, 38, 38, 0.25);
  --shadow: 0 20px 45px -20px rgba(61, 28, 28, 0.2);
  --input-bg: rgba(255, 255, 255, 0.75);
  --action-bg: rgba(220, 38, 38, 0.08);
  --pill-bg: rgba(220, 38, 38, 0.08);
  --pill-border: rgba(220, 38, 38, 0.2);
  --bg-image: radial-gradient(circle at 20% 0%, #fff1d6, transparent 60%),
    radial-gradient(circle at 90% 10%, #ffe4e6, transparent 55%);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
}

/* Decorative Elements */
.decoration-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.sakura {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0.6;
  animation: fall linear infinite;
}

@keyframes fall {
  0% { transform: translate(0, -10vh) rotate(0deg); opacity: 0; }
  20% { opacity: 0.8; }
  100% { transform: translate(20vw, 110vh) rotate(360deg); opacity: 0; }
}

.sakura-1 { left: 10%; animation-duration: 10s; animation-delay: 0s; }
.sakura-2 { left: 30%; animation-duration: 14s; animation-delay: 2s; }
.sakura-3 { left: 60%; animation-duration: 12s; animation-delay: 4s; }
.sakura-4 { left: 80%; animation-duration: 16s; animation-delay: 1s; }
.sakura-5 { left: 50%; animation-duration: 18s; animation-delay: 6s; }
.sakura-6 { left: 15%; animation-duration: 20s; animation-delay: 3s; }
.sakura-7 { left: 70%; animation-duration: 22s; animation-delay: 5s; }

.cloud {
  position: absolute;
  font-size: 3rem;
  opacity: 0.4;
  animation: drift linear infinite;
}

.cloud-1 { top: 12%; left: -15%; animation-duration: 36s; }
.cloud-2 { top: 28%; left: -25%; animation-duration: 42s; font-size: 2.5rem; }

.mountain {
  position: absolute;
  bottom: -12px;
  left: 6%;
  font-size: 6rem;
  opacity: 0.2;
}

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(120vw); }
}

.header {
  text-align: center;
  padding: 3rem 0;
  position: relative;
}

.shrine-gate {
  font-size: 4rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 20px rgba(220, 38, 38, 0.5));
}

.title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.title-japanese {
  font-size: 3.5rem;
  font-weight: 900;
  background: linear-gradient(to bottom, #fbbf24, #d97706);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.title-english {
  font-size: 1.2rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.subtitle {
  margin-top: 1rem;
  font-style: italic;
  color: var(--text-muted);
}

.fortune-section {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 3rem;
  align-items: center;
  margin-bottom: 4rem;
}

.omikuji-box {
  position: relative;
  width: 200px;
  height: 300px;
  margin: 0 auto;
  perspective: 1000px;
}

.omikuji-box.drawing {
  animation: shake 0.8s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  20% { transform: translateX(-4px) rotate(-1deg); }
  40% { transform: translateX(4px) rotate(1deg); }
  60% { transform: translateX(-3px) rotate(-0.5deg); }
  80% { transform: translateX(3px) rotate(0.5deg); }
}

.box-body {
  width: 100%;
  height: 100%;
  background: var(--box-body);
  border: 4px solid var(--box-border);
  border-radius: 4px;
  position: relative;
  box-shadow: var(--box-shadow);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.box-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  writing-mode: vertical-rl;
  font-size: 2.4rem;
  color: var(--box-border);
  font-weight: bold;
  opacity: 0.85;
  border: 2px solid var(--box-border);
  padding: 0.8rem 0.4rem;
  letter-spacing: 0.1rem;
  z-index: 0;
  pointer-events: none;
}

.fortune-sticks {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  height: 70%;
  z-index: 1;
  pointer-events: none;
}

.stick {
  width: 8px;
  border-radius: 999px;
  background: linear-gradient(to bottom, #fbbf24, #b45309);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

.stick:nth-child(1) { height: 55%; }
.stick:nth-child(2) { height: 70%; }
.stick:nth-child(3) { height: 60%; }
.stick:nth-child(4) { height: 80%; }
.stick:nth-child(5) { height: 65%; }

.box-lid {
  position: absolute;
  top: -20px;
  left: -10px;
  width: 220px;
  height: 40px;
  background: var(--box-lid);
  border: 2px solid var(--box-border);
  border-radius: 4px;
  z-index: 2;
}

.draw-area {
  background: var(--card);
  padding: 2.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.instruction {
  text-align: center;
  font-size: 1.4rem;
  margin-bottom: 2rem;
  color: var(--accent);
}

.name-input-wrapper,
.birthdate-input-wrapper,
.focus-input-wrapper,
.omikuji-type-wrapper {
  margin-bottom: 1.5rem;
}

.name-label,
.birthdate-label,
.focus-label,
.omikuji-type-label,
.tone-label,
.toggle-line {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.name-input,
.birthdate-input,
.focus-input,
.omikuji-type-select,
.tone-select {
  width: 100%;
  padding: 1rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-main);
  transition: var(--transition);
}

.name-input:focus,
.birthdate-input:focus,
.focus-input:focus,
.omikuji-type-select:focus,
.tone-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.draw-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.toggle-line {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.75rem;
  row-gap: 0.35rem;
  align-items: center;
}

.toggle-line input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.toggle-text {
  font-weight: 600;
  color: var(--text);
}

.toggle-hint {
  grid-column: 2 / -1;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tone-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.tone-label span {
  display: inline-block;
  margin-bottom: 0.4rem;
}

.draw-button {
  width: 100%;
  padding: 1.2rem;
  background: linear-gradient(to bottom, var(--primary), var(--primary-dark));
  border: 2px solid var(--accent);
  color: #fff;
  font-size: 1.2rem;
  font-weight: bold;
  border-radius: 3rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  margin-top: 1rem;
  box-shadow: var(--button-shadow);
}

.draw-button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--button-shadow-hover);
  filter: brightness(1.1);
}

.draw-button:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.25);
  filter: brightness(0.95);
  transition-duration: 0.1s;
}

.draw-button .button-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: button-shine 3s ease-in-out infinite;
}

@keyframes button-shine {
  0%, 100% { left: -100%; }
  50% { left: 100%; }
}

.draw-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--button-shadow);
  filter: grayscale(0.2);
}

.draw-button:disabled .button-shine {
  animation: none;
}

.draw-button .button-text::before {
  content: "🔮 ";
}

.status-pill-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.status-pill {
  background: var(--pill-bg);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--pill-border);
}

.status-pill.highlight {
  border-color: var(--pill-highlight-border, var(--accent));
  box-shadow: 0 0 0 2px var(--pill-highlight-shadow, rgba(251, 191, 36, 0.2));
}

.status-pill .pill-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.pill-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.pill-value {
  font-weight: 600;
  color: var(--text);
}

.fortune-paper {
  background: var(--paper-bg);
  color: var(--paper-text);
  padding: 3rem;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  font-family: 'Noto Serif JP', serif;
  border-left: 8px solid var(--paper-border);
  border-right: 8px solid var(--paper-border);
}

.fortune-paper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23000000' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
}

.paper-header {
  text-align: center;
  border-bottom: 2px solid var(--paper-border);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

.fortune-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.fortune-meta .meta-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.08);
  font-size: 0.75rem;
  color: var(--paper-text);
}

.fortune-level {
  font-size: 3rem;
  font-weight: 900;
  color: var(--paper-border);
  text-align: center;
  margin: 1rem 0;
  line-height: 1.4;
}

.fortune-message {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 2rem;
  font-weight: bold;
}

.fortune-details {
  display: grid;
  gap: 1rem;
}

.detail-item {
  border-bottom: 1px dashed var(--paper-divider);
  padding: 0.5rem 0;
  display: flex;
  justify-content: space-between;
}

.detail-label {
  font-weight: bold;
  color: var(--detail-label);
}

.action-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.action-btn {
  padding: 0.8rem 1.5rem;
  border-radius: 2rem;
  border: 1px solid var(--border);
  background: var(--action-bg);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
}

.action-btn.copy-btn {
  border-style: dashed;
}

.action-btn.download-btn {
  border-color: var(--accent);
}

.action-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.settings-section {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

.settings-grid {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.settings-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
}

.settings-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.history-section {
  margin-top: 2rem;
  display: grid;
  gap: 1rem;
}

.history-section .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.history-section h3 {
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.6rem;
}

.stat-item {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}

.stat-item.good {
  border-color: rgba(34, 197, 94, 0.4);
}

.stat-item.neutral {
  border-color: rgba(250, 204, 21, 0.4);
}

.stat-item.bad {
  border-color: rgba(239, 68, 68, 0.4);
}

.stat-number {
  font-size: 1.25rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.history-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

.history-controls .btn {
  border: 1px solid var(--border);
  background: var(--action-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}

.history-controls .btn.danger {
  border-color: rgba(239, 68, 68, 0.45);
}

.history-list {
  display: grid;
  gap: 0.5rem;
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 0.55rem;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.16);
  padding: 0.5rem 0.7rem;
}

.history-emoji {
  font-size: 1.1rem;
}

.history-level {
  font-weight: 600;
}

.history-date,
.history-name {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.history-reload-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: inherit;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.history-reload-btn:hover {
  border-color: var(--accent);
}

.info-section {
  margin-top: 4rem;
  background: var(--bg-panel);
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.info-section h3 {
  color: var(--accent);
  margin-bottom: 1.5rem;
  text-align: center;
}

.info-section h4 {
  color: var(--accent);
  margin: 2rem 0 1rem;
  text-align: center;
  font-size: 1.1rem;
}

/* Prediction Grid & Cards */
.prediction-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.prediction-card {
  background: rgba(220, 38, 38, 0.06);
  border: 1px solid rgba(220, 38, 38, 0.15);
  border-radius: 0.75rem;
  padding: 1rem;
  text-align: center;
}

.prediction-icon {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}

.prediction-title {
  font-weight: 700;
  color: var(--detail-label);
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
}

.prediction-text {
  font-size: 0.85rem;
  color: var(--paper-text);
  line-height: 1.5;
}

/* Lucky Info */
.lucky-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px dashed var(--paper-divider);
}

.lucky-section {
  text-align: center;
  padding: 0.6rem;
}

.lucky-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--detail-label);
  margin-bottom: 0.3rem;
}

.lucky-content {
  font-size: 0.9rem;
  color: var(--paper-text);
}

/* Fortune Advice */
.fortune-advice {
  text-align: center;
  font-size: 1rem;
  color: var(--paper-text);
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: rgba(220, 38, 38, 0.04);
  border-radius: 0.5rem;
  line-height: 1.6;
}

/* Encouragement */
.encouragement {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Info Cards Grid */
.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  transition: var(--transition);
}

.info-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.card-title {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.card-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Fortune Levels Grid */
.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.level-explanation {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  border-left: 4px solid var(--border);
}

.level-explanation.great-fortune {
  border-left-color: #22c55e;
}

.level-explanation.good-fortune {
  border-left-color: #3b82f6;
}

.level-explanation.moderate-fortune {
  border-left-color: #8b5cf6;
}

.level-explanation.small-fortune {
  border-left-color: #06b6d4;
}

.level-explanation.future-fortune {
  border-left-color: #f59e0b;
}

.level-explanation.challenging {
  border-left-color: #ef4444;
}

.level-title {
  font-weight: 700;
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
}

.level-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* History Timeline */
.history-timeline {
  display: grid;
  gap: 1rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  padding: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

.timeline-year {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.85rem;
  white-space: nowrap;
}

.timeline-content {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .fortune-section {
    grid-template-columns: 1fr;
  }
  
  .title-japanese {
    font-size: 2.5rem;
  }

  .draw-options {
    grid-template-columns: 1fr;
  }

  .prediction-grid {
    grid-template-columns: 1fr;
  }

  .history-item {
    grid-template-columns: auto 1fr auto;
  }

  .history-name {
    display: none;
  }

  .fortune-paper {
    padding: 1.5rem;
  }

  .fortune-level {
    font-size: 2.2rem;
  }

  .fortune-message {
    font-size: 1.2rem;
  }

  .draw-area {
    padding: 1.5rem;
  }
}

@media (max-width: 374px) {
  .container {
    padding: 1rem 0.75rem;
  }

  .title-japanese {
    font-size: 2rem;
  }

  .title-english {
    font-size: 0.9rem;
    letter-spacing: 0.1em;
  }

  .draw-area {
    padding: 1rem;
  }

  .fortune-paper {
    padding: 1rem;
    border-left-width: 4px;
    border-right-width: 4px;
  }

  .fortune-level {
    font-size: 1.8rem;
  }

  .fortune-message {
    font-size: 1rem;
  }

  .status-pill {
    padding: 0.35rem 0.6rem;
    font-size: 0.7rem;
  }

  .status-pill .pill-icon {
    font-size: 0.85rem;
  }

  .action-buttons {
    flex-direction: column;
    align-items: stretch;
  }

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

  .omikuji-box {
    width: 140px;
    height: 210px;
  }

  .box-lid {
    width: 160px;
    left: -10px;
    height: 32px;
    top: -16px;
  }

  .box-label {
    font-size: 1.8rem;
  }

  .settings-grid {
    gap: 0.5rem;
  }

  .settings-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }

  .info-cards {
    grid-template-columns: 1fr;
  }

  .levels-grid {
    grid-template-columns: 1fr;
  }

  .lucky-info {
    grid-template-columns: 1fr 1fr;
  }
}

/* Focus-visible accessibility styles */
.draw-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  box-shadow: var(--button-shadow-hover), 0 0 0 6px rgba(251, 191, 36, 0.15);
}

.settings-btn:focus-visible,
.action-btn:focus-visible,
.history-reload-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.name-input:focus-visible,
.birthdate-input:focus-visible,
.focus-input:focus-visible,
.omikuji-type-select:focus-visible,
.tone-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}

.toggle-line:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.history-controls .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Fortune result reveal animation */
.result-section.reveal .fortune-paper {
  animation: fortune-reveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes fortune-reveal {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95) rotateX(8deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotateX(0deg);
  }
}

.result-section.reveal .action-buttons {
  animation: fade-up 0.5s ease-out 0.35s both;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* History section polish */
.history-section .card {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transition: var(--transition);
}

.history-item {
  transition: var(--transition);
  border-color: var(--pill-border);
  background: var(--pill-bg);
}

.history-item:hover {
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

body[data-theme="light"] .history-item {
  border-color: rgba(220, 38, 38, 0.15);
  background: rgba(255, 255, 255, 0.6);
}

body[data-theme="light"] .history-item:hover {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.9);
}

/* Shrine lantern decorations */
.decoration-bg::before,
.decoration-bg::after {
  content: '🏮';
  position: fixed;
  font-size: 2rem;
  opacity: 0.3;
  animation: lantern-sway 4s ease-in-out infinite;
}

.decoration-bg::before {
  top: 8%;
  left: 3%;
}

.decoration-bg::after {
  top: 12%;
  right: 3%;
  animation-delay: -2s;
}

@keyframes lantern-sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

/* Omikuji box responsive sizing */
.omikuji-box {
  max-width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .sakura,
  .cloud,
  .omikuji-box.drawing {
    animation: none;
  }

  .draw-button,
  .action-btn,
  .settings-btn,
  .history-item {
    transition: none;
  }

  .draw-button:hover {
    transform: none;
    box-shadow: var(--button-shadow);
  }

  .draw-button .button-shine {
    animation: none;
  }

  .result-section.reveal .fortune-paper,
  .result-section.reveal .action-buttons {
    animation: none;
  }

  .decoration-bg::before,
  .decoration-bg::after {
    animation: none;
  }
}
