:root {
  --pink: #e8a0b4;
  --pink-deep: #d4607a;
  --purple: #9b7fc4;
  --purple-light: #c4a8e8;
  --purple-pale: #e8dcf5;
  --bg-dark: #2a1f35;
  --text-dark: #4a3f55;
  --text-mid: #7a6a8a;
  --white-soft: #faf8fc;
  --shadow: rgba(100, 60, 130, 0.25);
}

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

body {
  font-family: "Zen Maru Gothic", sans-serif;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

a {
  text-decoration: none;
}

/* ====== 背景 ====== */
.bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    160deg,
    #1a1228 0%,
    #2d1f3d 20%,
    #4a2545 40%,
    #7a3a5a 60%,
    #c4706a 80%,
    #e8a880 100%
  );
  z-index: 0;
}

.bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
      ellipse 80% 60% at 30% 70%,
      rgba(232, 160, 180, 0.3) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 60% 80% at 70% 20%,
      rgba(155, 127, 196, 0.25) 0%,
      transparent 50%
    );
}

/* ====== ホーム画面 ====== */
.home {
  width: 80%;
  margin: auto;
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: stretch;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.home.visible {
  opacity: 1;
  pointer-events: all;
}

.character-area {
  flex: 0 0 45%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
}

.character-placeholder {
  height: 100%;
}

.character-placeholder img {
  height: 150vh;
  object-fit: contain;
  object-position: bottom;
}

.serif-window {
  position: absolute;
  bottom: 120px;
  left: 20px;
  right: -20px;
  background: rgba(255, 255, 255, 0.88);
  border: 2px solid rgba(196, 168, 232, 0.6);
  border-radius: 16px;
  padding: 18px 22px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 24px rgba(100, 60, 130, 0.15);
  z-index: 10;
  min-height: 90px;
}

.serif-text {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-dark);
  font-weight: 500;
}

.serif-name {
  font-size: 11px;
  color: var(--purple);
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.right-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 30px 30px 0;
  gap: 16px;
}

/* ====== 時計 ====== */
.clock-circle {
  width: 300px;
  height: 300px;
  background: rgba(155, 127, 196, 0.35);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 30px rgba(100, 60, 130, 0.2);
}

.clock-time {
  font-family: "Kaisei Tokumin", serif;
  font-size: 5em;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 10px rgba(100, 60, 130, 0.4);
  letter-spacing: 2px;
}

.clock-colon {
  animation: blink 1s step-start infinite;
  display: inline-block;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

.clock-time-mobile {
  display: none;
}

/* ====== ホームボタン ====== */
.main-btn {
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid rgba(196, 168, 232, 0.5);
  border-radius: 20px;
  margin: 45px 0;
  padding: 20px 32px;
  font-family: "Zen Maru Gothic", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  width: 260px;
  text-align: center;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(100, 60, 130, 0.15);
  transition: all 0.2s ease;
}

.main-btn:hover {
  background: rgba(232, 160, 180, 0.9);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(212, 96, 122, 0.3);
}

.sub-btns {
  display: flex;
  gap: 12px;
  width: 260px;
}

.sub-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.75);
  border: 2px solid rgba(196, 168, 232, 0.4);
  border-radius: 16px;
  padding: 18px 8px;
  font-family: "Zen Maru Gothic", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  text-align: center;
  line-height: 1.6;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.sub-btn:hover {
  background: rgba(155, 127, 196, 0.85);
  color: #fff;
  transform: translateY(-2px);
}

/* ====== 設定ボタン ====== */
.settings-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: rgba(155, 127, 196, 0.6);
  border: none;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 100;
}

.settings-btn:hover {
  background: rgba(155, 127, 196, 0.9);
  transform: rotate(30deg);
}

/* ====== 共通モーダル ====== */
.dream-page,
.login-page {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dream-modal,
.login-modal {
  background: var(--white-soft);
  border: 3px solid var(--purple-light);
  border-radius: 24px;
  padding: 28px 24px;
  width: 92%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 60px rgba(80, 40, 120, 0.35);
  animation: modalIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.login-modal {
  max-width: 480px;
  text-align: center;
}

@keyframes modalIn {
  from {
    transform: scale(0.85) translateY(20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.dream-modal h2 {
  font-family: "Kaisei Tokumin", serif;
  font-size: 22px;
  color: var(--text-dark);
  margin-bottom: 18px;
  text-align: center;
}

/* ====== ログインページ ====== */
.modal-title {
  font-family: "Kaisei Tokumin", serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.6;
  margin-bottom: 6px;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-mid);
  margin-bottom: 28px;
  letter-spacing: 0.1em;
}

.input-group {
  margin-bottom: 14px;
  text-align: left;
}

.login-input {
  width: 100%;
  padding: 14px 18px;
  background: #ece9f1;
  border: 2px solid transparent;
  border-radius: 14px;
  font-family: "Zen Maru Gothic", sans-serif;
  font-size: 15px;
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.login-input:focus {
  border-color: var(--purple-light);
  background: #f5f2fa;
}

.login-input::placeholder {
  color: #b0a0c0;
}

.login-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #e8708a, #d4607a);
  border: none;
  border-radius: 14px;
  font-family: "Zen Maru Gothic", sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  margin-top: 10px;
  margin-bottom: 20px;
  letter-spacing: 0.1em;
  box-shadow: 0 4px 18px rgba(212, 96, 122, 0.35);
  transition: all 0.2s ease;
}

.login-btn:hover {
  background: linear-gradient(135deg, #d4607a, #c04060);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(192, 64, 96, 0.4);
}

.modal-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-links a {
  font-size: 13px;
  color: var(--pink-deep);
  text-decoration: none;
  transition: color 0.2s;
}

.modal-links a:hover {
  color: var(--purple);
  text-decoration: underline;
}

.error-msg {
  background: #fde8ec;
  border: 1px solid #f4b0be;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #c04060;
  margin-bottom: 12px;
  display: none;
}

.error-msg.show {
  display: block;
}

/* ====== 夢入力フォーム ====== */
.dream-textarea {
  width: 100%;
  height: 130px;
  padding: 14px 16px;
  background: #ece9f1;
  border: 2px solid transparent;
  border-radius: 14px;
  font-family: "Zen Maru Gothic", sans-serif;
  font-size: 14px;
  color: var(--text-dark);
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.7;
}

.dream-textarea:focus {
  border-color: var(--purple-light);
  background: #f5f2fa;
}

.dream-type-label {
  margin: 16px 0 8px;
  font-size: 13px;
  color: var(--text-mid);
}

.dream-options {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.dream-radio {
  display: none;
}

.dream-opt-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--purple-light);
  border-radius: 12px;
  background: transparent;
  font-family: "Zen Maru Gothic", sans-serif;
  font-size: 13px;
  color: var(--text-mid);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  display: block;
}

.dream-radio:checked + .dream-opt-btn {
  background: var(--purple-light);
  color: #fff;
  border-color: var(--purple);
}

.dream-submit-btn {
  width: 100%;
  padding: 14px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #e8708a, #d4607a);
  border: none;
  border-radius: 14px;
  font-family: "Zen Maru Gothic", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  letter-spacing: 0.08em;
  box-shadow: 0 4px 18px rgba(212, 96, 122, 0.3);
  transition: all 0.2s;
}

.dream-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(212, 96, 122, 0.4);
}

.dream-close-btn {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--text-mid);
  cursor: pointer;
  width: 100%;
  text-align: center;
  display: block;
  text-decoration: none;
}

/* ====== ページネーション ====== */
.pagination {
  display: flex;
  gap: 8px;
  padding: 10px;
  margin-bottom: 16px;
  justify-content: center;
}

.pagination a,
.pagination span {
  color: var(--text-mid);
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
}

.pagination .current {
  color: var(--bg-dark);
  background-color: #ece9f1;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 8px;
  font-size: 13px;
}

.pagination a:hover {
  background-color: rgba(155, 127, 196, 0.2);
}
/* ====== 夢の記録詳細ページ ====== */
.show-modal {
  max-width: 600px;
}

.show-date {
  font-size: 12px;
  color: var(--text-mid);
  text-align: center;
  margin-bottom: 12px;
}

.show-type-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 16px;
}

.show-type-badge.最高 {
  background: rgba(232, 160, 180, 0.3);
  color: var(--pink-deep);
  border: 2px solid var(--pink);
}

.show-type-badge.普通 {
  background: rgba(155, 127, 196, 0.2);
  color: var(--purple);
  border: 2px solid var(--purple-light);
}

.show-type-badge.最悪 {
  background: rgba(100, 60, 130, 0.15);
  color: var(--text-dark);
  border: 2px solid rgba(100, 60, 130, 0.3);
}

.show-content {
  background: #ece9f1;
  border-radius: 14px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-dark);
  margin-bottom: 20px;
}

.bakura-response-box {
  background: linear-gradient(135deg, #f5f0fb, #fde8f0);
  border: 2px solid var(--purple-light);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.bakura-response-name {
  font-size: 11px;
  color: var(--purple);
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

.bakura-response-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-dark);
}

.show-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.delete-btn {
  font-size: 12px;
  color: #c04060;
  text-decoration: none;
  cursor: pointer;
}

.delete-btn:hover {
  text-decoration: underline;
}

.dream-opt-icon {
  width: 24px;
  height: 24px;
  display: block;
  margin: 0 auto 4px;
  filter: invert(60%) sepia(10%) saturate(500%) hue-rotate(220deg)
    brightness(90%);
}

.dream-radio:checked + .dream-opt-btn .dream-opt-icon {
  opacity: 1;
  filter: brightness(100%) drop-shadow(0 0 6px rgba(196, 168, 232, 0.9));
}

/* ====== ねむねむノート一覧ページ ====== */
.index-modal {
  max-width: 600px;
  max-height: 80vh;
}

.empty-message {
  text-align: center;
  color: var(--text-mid);
  font-size: 14px;
  line-height: 2;
  padding: 40px 0;
}

.dream-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  overflow-y: auto;
  max-height: 50vh;
}

.dream-list-item {
  background: #ece9f1;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dream-list-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dream-list-date {
  font-size: 12px;
  color: var(--text-mid);
}

.dream-list-content {
  font-size: 13px;
  color: var(--text-dark);
  line-height: 1.6;
}

.dream-list-link {
  font-size: 12px;
  color: var(--purple);
  text-decoration: none;
  text-align: right;
}

.dream-list-link:hover {
  text-decoration: underline;
}

/* ====== 設定モーダル ====== */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 18, 45, 0.6);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.settings-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.settings-modal {
  background: var(--white-soft);
  border: 3px solid var(--purple-light);
  border-radius: 24px;
  padding: 28px 24px;
  width: 92%;
  max-width: 380px;
  box-shadow: 0 12px 60px rgba(80, 40, 120, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-title {
  font-family: "Kaisei Tokumin", serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  text-align: center;
  margin-bottom: 8px;
}

.settings-item-btn {
  width: 100%;
  padding: 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid rgba(196, 168, 232, 0.5);
  border-radius: 14px;
  font-family: "Zen Maru Gothic", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-item-btn.btn-1 {
  background: rgba(155, 127, 196, 0.85);
  color: #fff;
}

.settings-item-btn:hover {
  background: rgba(155, 127, 196, 1);
}

.settings-item-btn.danger {
  border-color: rgba(212, 96, 122, 0.4);
  background: rgba(212, 96, 122, 0.85);
  color: #fff;
}

.settings-item-btn.danger:hover {
  background: rgba(212, 96, 122, 1);
}

.settings-close-btn {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--text-mid);
  cursor: pointer;
  text-align: center;
  padding: 8px;
}

/* ====== ばくらについてページ ====== */
.show-modal.about-show {
  max-width: 800px;
  height: 60vh;
}

.about-info {
  margin: 5em 3em;
}

.about-profile {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.about-img {
  flex: 0 0 160px;
  border-radius: 16px;
  background: #ece9f1;
}

.about-img img {
  width: auto;
  height: 90vh;
  overflow: hidden;
}

.about-name {
  font-family: "Kaisei Tokumin", serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.about-desc {
  font-size: 14px;
  line-height: 2;
  color: var(--text-mid);
}

/* ====== エラーメッセージ ====== */
.error-box {
  background: #fde8ec;
  border: 1px solid #f4b0be;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.error-title {
  font-size: 12px;
  color: #c04060;
  font-weight: 700;
  margin-bottom: 6px;
}

.error-list {
  list-style: none;
  padding: 0;
}

.error-list li {
  font-size: 11px;
  color: #c04060;
  padding: 2px 0;
}

/* ====== フラッシュメッセージ ====== */
.flash {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.flash-notice {
  background: rgba(155, 127, 196, 0.9);
  color: #fff;
  box-shadow: 0 4px 20px rgba(100, 60, 130, 0.3);
}

.flash-alert {
  background: rgba(212, 96, 122, 0.9);
  color: #fff;
  box-shadow: 0 4px 20px rgba(212, 96, 122, 0.3);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ====== 静的ページ（利用規約・プライバシーポリシー） ====== */
.static-content {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}

.static-content h3 {
  font-size: 14px;
  color: var(--purple);
  margin-top: 16px;
  margin-bottom: 8px;
}

.static-content p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.static-content ul {
  margin-left: 20px;
  margin-bottom: 8px;
}

.static-content li {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-dark);
}

.static-date {
  text-align: right;
  font-size: 11px;
  color: var(--text-mid);
  margin-top: 16px;
}

.static-links {
  margin-top: 16px;
  text-align: center;
  font-size: 11px;
}

.static-links a {
  color: var(--text-mid);
  text-decoration: none;
}

.static-links a:hover {
  text-decoration: underline;
}

/* ====== 初回ログインガイド ====== */
.guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(30, 18, 45, 0.7);
  backdrop-filter: blur(8px);
}

.guide-overlay.visible {
  display: flex;
}

.guide-modal {
  background: var(--white-soft);
  border: 3px solid var(--purple-light);
  border-radius: 24px;
  padding: 32px 28px;
  width: 92%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 12px 60px rgba(80, 40, 120, 0.4);
  animation: modalIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.guide-img {
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
  overflow: hidden;
  border-radius: 50%;
  background: #ece9f1;
}

.guide-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.guide-title {
  font-family: "Kaisei Tokumin", serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
}

.guide-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-mid);
  margin-bottom: 24px;
}

.guide-close-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #e8708a, #d4607a);
  border: none;
  border-radius: 14px;
  font-family: "Zen Maru Gothic", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(212, 96, 122, 0.3);
  transition: all 0.2s ease;
}

.guide-close-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(212, 96, 122, 0.4);
}

/* ====== スマホ対応（600px以下） ====== */
@media (max-width: 600px) {
  .home {
    width: 100%;
    flex-direction: column;
    align-items: center;
    overflow: visible;
  }

  .character-area {
    flex: 1;
    width: 100%;
    min-height: 0;
  }

  .serif-window {
    bottom: 10px;
    left: 12px;
    right: 12px;
    padding: 14px 16px;
    min-height: 75px;
  }

  .serif-text {
    font-size: 13px;
  }

  .right-area {
    flex: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    padding: 10px 20px 80px;
    gap: 10px;
  }

  .clock-circle {
    display: none;
  }

  .clock-time-mobile {
    display: block;
    position: fixed;
    top: 16px;
    right: 20px;
    font-family: "Kaisei Tokumin", serif;
    font-size: 2em;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 8px rgba(60, 20, 80, 0.5);
    letter-spacing: 2px;
    z-index: 50;
  }

  .main-btn {
    width: 100%;
    font-size: 17px;
    padding: 15px 20px;
    margin: 0;
  }

  .sub-btns {
    width: 100%;
    gap: 10px;
  }

  .sub-btn {
    font-size: 12px;
    padding: 13px 6px;
  }

  /*ばくらについて*/
  .about-profile {
    flex-direction: column;
  }

  .about-info {
    margin: 0;
  }
}
