﻿:root {
  --dailybook-primary-red: #d92424;
  --dailybook-dark-red: #8a0000;
  --dailybook-border-red: #b91c1c;
  --dailybook-gold: #ffcc00;
  --dailybook-paper: #fffcf5;
}

html,
body.dailybook-body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #a60000;
  font-family: "Noto Serif SC", "Songti SC", "Microsoft YaHei", serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.dailybook-root {
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

.app-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.layer.bg { z-index: 0; }
.layer.scene { z-index: 1; }
.layer.ui { z-index: 10; pointer-events: none; }
.layer.modal { z-index: 100; }

.bg-pattern {
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 239, 161, 0.26), transparent 28%),
    radial-gradient(circle at center, #ff5e5e 0%, #a60000 100%);
}

.bg-pattern::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image: 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='%23ffdb4d' fill-opacity='1'%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/svg%3E");
}

.dailybook-home {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 30;
  pointer-events: auto;
  color: #8b0000;
  background: rgba(255, 252, 245, 0.92);
  border: 1px solid rgba(255, 204, 0, 0.8);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(70, 0, 0, 0.22);
}

.header-container {
  position: absolute;
  top: 5%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

.plaque {
  position: relative;
  background-color: #990000;
  border-top: 3px solid var(--dailybook-gold);
  border-bottom: 3px solid var(--dailybook-gold);
  padding: 0.6rem 2rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  color: #fff8e7;
  white-space: nowrap;
}

.plaque-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background-color: var(--dailybook-gold);
  border-radius: 50%;
  box-shadow: 0 0 5px var(--dailybook-gold);
}

.main-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  background: linear-gradient(to bottom, #fff, #ffe4b5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sub-title {
  margin-top: 0.6rem;
  color: #ffe4b5;
  font-size: 1rem;
  letter-spacing: 0.2em;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.controls-container {
  position: absolute;
  bottom: 8%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
}

.toast {
  background-color: #fffbf0;
  color: #8b0000;
  border: 2px solid #8b0000;
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  font-weight: bold;
  letter-spacing: 0.1em;
  transition: all 0.5s ease;
  text-align: center;
  font-size: 0.9rem;
  max-width: min(86vw, 520px);
}

.btn-shake {
  background: linear-gradient(to bottom, #ffeb3b, #ffb300);
  color: #990000;
  border: 2px solid #fff;
  padding: 0.8rem 2.5rem;
  border-radius: 50px;
  font-size: 1.3rem;
  font-weight: bold;
  letter-spacing: 0.3em;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 179, 0, 0.6);
  transition: transform 0.1s;
  font-family: inherit;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-shake:active { transform: scale(0.95); }

.modal-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s forwards;
  padding: 10px;
  box-sizing: border-box;
}

.fortune-card {
  position: relative;
  background-color: var(--dailybook-paper);
  width: 100%;
  max-width: 380px;
  max-height: 96vh;
  border-radius: 12px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 1.5rem 1.2rem 1.2rem;
  text-align: center;
  border: 5px solid var(--dailybook-border-red);
  overflow: hidden;
}

.fortune-card-inner-border {
  position: absolute;
  inset: 5px;
  border: 2px solid #d4af37;
  border-radius: 8px;
  pointer-events: none;
  z-index: 5;
}

.fortune-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 0;
  overflow: visible;
}

.fortune-cover-stamp {
  position: absolute;
  top: 20px;
  right: 22px;
  z-index: 30;
  width: 64px;
  height: 64px;
  padding: 5px;
  border: 1px solid rgba(180, 118, 33, 0.62);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 251, 239, 0.98), rgba(255, 238, 198, 0.92));
  box-shadow:
    0 10px 24px rgba(93, 29, 0, 0.22),
    inset 0 0 0 2px rgba(255, 255, 255, 0.75),
    inset 0 0 0 4px rgba(212, 175, 55, 0.28);
  cursor: zoom-in;
  transform: rotate(2deg);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fortune-cover-stamp::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(139, 0, 0, 0.16);
  border-radius: 9px;
  pointer-events: none;
}

.fortune-cover-stamp:hover {
  transform: rotate(0deg) translateY(-1px) scale(1.04);
  box-shadow:
    0 14px 30px rgba(93, 29, 0, 0.3),
    inset 0 0 0 2px rgba(255, 255, 255, 0.82),
    inset 0 0 0 4px rgba(212, 175, 55, 0.34);
}

.fortune-cover-stamp img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 7px;
}

.fortune-cover-stamp + .fortune-content-wrapper {
  padding-top: 1.4rem;
}

.fortune-level {
  color: var(--dailybook-border-red);
  font-size: 1.2rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  margin-bottom: 0.2rem;
  display: none;
}

.fortune-title {
  color: #d10000;
  font-size: clamp(1.85rem, 5.8vw, 2.35rem);
  font-weight: 900;
  margin: 0.1rem auto 0.55rem;
  letter-spacing: 0.04em;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
  line-height: 1.14;
  max-width: 100%;
  text-wrap: balance;
  word-break: normal;
  overflow-wrap: anywhere;
}

.fortune-title-balanced {
  font-size: clamp(1.65rem, 5.2vw, 2rem);
  letter-spacing: 0.035em;
  line-height: 1.16;
  max-width: 17em;
}

.fortune-title-compact {
  font-size: clamp(1.42rem, 4.7vw, 1.78rem);
  letter-spacing: 0.02em;
  line-height: 1.18;
  max-width: 18em;
}

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.5rem 0;
  opacity: 0.6;
  width: 100%;
}

.divider-line {
  height: 1px;
  background: #8b0000;
  width: 25px;
  margin: 0 8px;
}

.poem-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  margin: 0.5rem 0;
  width: 100%;
  background-color: rgba(255, 235, 185, 0.2);
  padding: 0.8rem;
  border-radius: 4px;
  box-sizing: border-box;
}

.poem-line {
  font-size: 1.1rem;
  font-weight: bold;
  color: #333;
  letter-spacing: 0.05em;
  text-align: center;
  line-height: 1.4;
  width: 100%;
}

.explanation-box {
  background-color: #fff5e6;
  border: 1px solid #f5deb3;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  margin-top: 0.5rem;
  margin-bottom: 0.8rem;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

.explanation-title {
  color: #b8860b;
  font-size: 0.8rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 0.3rem;
}

.explanation-text {
  color: #5c4033;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: justify;
  margin: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow: visible;
}

.btn-container {
  margin-top: 0.5rem;
  width: 100%;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(to bottom, #d92424, #b91c1c);
  color: white;
  padding: 0.7rem;
  font-size: 1rem;
  font-weight: bold;
  border: 2px solid #d4af37;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.2em;
  transition: all 0.2s;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}

.btn-primary:hover {
  background: linear-gradient(to bottom, #e53e3e, #c53030);
  transform: translateY(-1px);
}

.btn-purchase {
  display: block;
  text-decoration: none;
  background: linear-gradient(to bottom, #ffe880, #f2b92b);
  color: #8b0000;
  border-color: #d4af37;
}

.btn-purchase:hover {
  background: linear-gradient(to bottom, #fff1a8, #f0c34a);
}

.cover-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(23, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  box-sizing: border-box;
  animation: fadeIn 0.2s forwards;
}

.cover-preview-image {
  max-width: min(86vw, 520px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 18px;
  border: 6px solid #fff7df;
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.55),
    0 0 0 2px #d4af37;
}

.cover-preview-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 235, 185, 0.7);
  border-radius: 50%;
  background: rgba(255, 252, 245, 0.96);
  color: #8b0000;
  font-size: 30px;
  line-height: 38px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
  border: 4px solid #fed7d7;
  border-top: 4px solid #e53e3e;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

.api-notice {
  color: #9f1239;
  background: rgba(255, 241, 242, 0.92);
  border: 1px solid #fecdd3;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 0.82rem;
  line-height: 1.5;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 720px) {
  .dailybook-home { top: 12px; left: 12px; font-size: 13px; }
  .plaque { padding: 0.5rem 1.2rem; }
  .main-title { font-size: 1.6rem; letter-spacing: 0.12em; }
  .sub-title { font-size: 0.9rem; }
}

@media (max-height: 700px) {
  .fortune-card { padding: 1rem; }
  .fortune-title { font-size: 1.8rem; margin-bottom: 0.3rem; }
  .poem-line { font-size: 1.05rem; letter-spacing: 0.08em; }
  .explanation-box { padding: 0.5rem; margin-bottom: 0.5rem; }
  .explanation-text { font-size: 0.85rem; }
  .btn-primary { padding: 0.6rem; }
}
