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

body {
  font-family: 'Zen Maru Gothic', sans-serif;
  background: #f0ecf5;
  min-height: 100vh;
  color: #4a3a5c;
}

/* ========================================
   App Layout
======================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ========================================
   Sidebar
======================================== */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: linear-gradient(180deg, #2d1b4e 0%, #1a0e30 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(30, 15, 60, 0.3);
}

.sidebar-header {
  padding: 28px 24px 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  font-size: 2.4rem;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 12px rgba(180, 140, 255, 0.5));
  animation: floatLogo 4s ease-in-out infinite;
}

@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.sidebar-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.08em;
}

.sidebar-subtitle {
  font-size: 0.72rem;
  color: rgba(200, 180, 240, 0.7);
  margin-top: 2px;
  letter-spacing: 0.15em;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: rgba(220, 210, 240, 0.75);
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
  margin-bottom: 4px;
  position: relative;
}

.nav-item:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(135deg, #7c4dff, #6a3de8);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(124, 77, 255, 0.35);
}

.nav-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.nav-icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
}

.nav-badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: rgba(200, 190, 220, 0.6);
  font-weight: 400;
}

.nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 14px 8px;
}

.nav-section-label {
  font-size: 0.7rem;
  color: rgba(200, 180, 240, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0 16px 8px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 8px 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ========================================
   Mobile Hamburger & Overlay
======================================== */
.hamburger {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: rgba(45, 27, 78, 0.95);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 4px 16px rgba(30, 15, 60, 0.3);
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.open span:nth-child(2) {
  opacity: 0;
}
.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
  display: block;
}

/* ========================================
   Main Content
======================================== */
.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  background: linear-gradient(180deg, #eee8f5 0%, #f5f0fa 40%, #f8f5fc 100%);
}

.page {
  display: none;
  padding: 32px 36px;
  animation: pageIn 0.4s ease;
}

.page.active {
  display: block;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2d1b4e;
}

/* ========================================
   Dashboard - Welcome
======================================== */
/* Dashboard Background */
#page-dashboard {
  position: relative;
}

.dashboard-bg-img {
  position: fixed;
  top: 0;
  left: 260px;
  width: calc(100% - 260px);
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  z-index: 0;
  pointer-events: none;
}

.dashboard-bg-overlay {
  position: fixed;
  top: 0;
  left: 260px;
  width: calc(100% - 260px);
  height: 100%;
  background: radial-gradient(
    ellipse at center 30%,
    rgba(15, 8, 30, 0.35) 0%,
    rgba(15, 8, 30, 0.65) 50%,
    rgba(15, 8, 30, 0.85) 100%
  );
  z-index: 0;
  pointer-events: none;
}

#page-dashboard .page-header,
#page-dashboard .welcome-card,
#page-dashboard .dashboard-grid {
  position: relative;
  z-index: 1;
}

.page-title-light {
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* Welcome Card */
.welcome-card {
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.welcome-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.welcome-text {
  font-size: 0.84rem;
  color: rgba(220, 210, 240, 0.8);
  line-height: 1.6;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}

/* ========================================
   Dashboard - Grid Cards
======================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.dash-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.dash-card:hover:not(.dash-card-disabled) {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.25);
}

.dash-card-disabled {
  opacity: 0.5;
  cursor: default;
}

.dash-card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.dash-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}

.dash-card-desc {
  font-size: 0.82rem;
  color: rgba(210, 200, 230, 0.8);
  line-height: 1.5;
}

.dash-card-arrow {
  position: absolute;
  top: 24px;
  right: 20px;
  font-size: 1.2rem;
  color: rgba(200, 180, 240, 0.5);
  transition: transform 0.3s, color 0.3s;
}

.dash-card:hover:not(.dash-card-disabled) .dash-card-arrow {
  transform: translateX(4px);
  color: #fff;
}

.dash-card-badge {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.7rem;
  padding: 3px 12px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(200, 190, 220, 0.7);
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ========================================
   Updates Timeline
======================================== */
.updates-timeline {
  position: relative;
}

/* --- 月グループ --- */
.update-month {
  margin-bottom: 32px;
}

.update-month-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #2d1b4e;
  cursor: pointer;
  padding: 12px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.08), rgba(160, 109, 255, 0.04));
  border: 1px solid rgba(124, 77, 255, 0.12);
  user-select: none;
  list-style: none;
  transition: background 0.2s;
}

.update-month-header::-webkit-details-marker {
  display: none;
}

.update-month-header::before {
  content: '▶';
  font-size: 0.7rem;
  color: #7c4dff;
  transition: transform 0.25s;
  flex-shrink: 0;
}

.update-month[open] > .update-month-header::before {
  transform: rotate(90deg);
}

.update-month-header:hover {
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.14), rgba(160, 109, 255, 0.08));
}

.update-month-body {
  position: relative;
  padding-left: 32px;
  margin-top: 20px;
}

.update-month-body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 11px;
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, #7c4dff, #d4c4e8 80%, transparent);
  border-radius: 2px;
}

/* --- 各エントリ --- */
.update-entry {
  position: relative;
  margin-bottom: 28px;
}

.update-entry:last-child {
  margin-bottom: 0;
}

.update-dot {
  position: absolute;
  left: -27px;
  top: 20px;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, #7c4dff, #a06dff);
  border-radius: 50%;
  border: 3px solid #f0ecf5;
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.2);
}

.update-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px 28px;
  border: 1px solid rgba(200, 180, 240, 0.2);
  box-shadow: 0 2px 12px rgba(100, 70, 160, 0.06);
  transition: box-shadow 0.3s;
}

.update-card:hover {
  box-shadow: 0 6px 24px rgba(100, 70, 160, 0.12);
}

.update-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: #7c4dff;
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}

.update-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #2d1b4e;
  margin-bottom: 12px;
}

.update-body {
  font-size: 0.88rem;
  color: #6b5a80;
  line-height: 1.7;
}

.update-body ul {
  padding-left: 18px;
}

.update-body li {
  margin-bottom: 4px;
}

.update-body li::marker {
  color: #b8a0d8;
}

/* ========================================
   Generator Menu
======================================== */
.gen-section {
  margin-bottom: 32px;
}

.gen-section:last-child {
  margin-bottom: 0;
}

.gen-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #2d1b4e;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(124, 77, 255, 0.12);
}

.gen-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.gen-menu-card {
  background: #fff;
  border-radius: 18px;
  padding: 28px 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(200, 180, 240, 0.2);
  box-shadow: 0 2px 12px rgba(100, 70, 160, 0.06);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.gen-menu-card:hover:not(.gen-menu-card-disabled) {
  transform: translateY(-4px);
  box-shadow: 0 10px 36px rgba(100, 70, 160, 0.16);
  border-color: rgba(124, 77, 255, 0.35);
}

.gen-menu-card-disabled {
  opacity: 0.48;
  cursor: default;
}

.gen-menu-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.gen-menu-icon {
  font-size: 1.6rem;
}

.gen-menu-icon-purple {
  background: linear-gradient(135deg, #ece0ff, #ddd0f8);
}

.gen-menu-icon-gold {
  background: linear-gradient(135deg, #fff3d0, #ffe8a8);
}

.gen-menu-icon-rose {
  background: linear-gradient(135deg, #ffe0ee, #ffd0e4);
}

.gen-menu-icon-blue {
  background: linear-gradient(135deg, #dde8ff, #ccdcff);
}

.gen-menu-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #2d1b4e;
  margin-bottom: 8px;
}

.gen-menu-desc {
  font-size: 0.82rem;
  color: #8a7a9e;
  line-height: 1.6;
  flex: 1;
}

.gen-menu-arrow {
  position: absolute;
  top: 28px;
  right: 22px;
  font-size: 1.3rem;
  color: #c4b0e8;
  transition: transform 0.3s, color 0.3s;
}

.gen-menu-card:hover:not(.gen-menu-card-disabled) .gen-menu-arrow {
  transform: translateX(4px);
  color: #7c4dff;
}

.gen-menu-badge {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.7rem;
  padding: 3px 14px;
  background: linear-gradient(135deg, #f0ecf5, #e8e0f2);
  color: #a090b8;
  border-radius: 20px;
  font-weight: 600;
}

/* ========================================
   Generator - Container (inner screens)
======================================== */
.container {
  max-width: 680px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Card
======================================== */
.card {
  background: #fff;
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: 0 2px 16px rgba(100, 70, 160, 0.07);
  border: 1px solid rgba(200, 180, 240, 0.2);
}

.title {
  text-align: center;
  font-size: 1.45rem;
  font-weight: 700;
  color: #3a1d6e;
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}

.subtitle {
  text-align: center;
  font-size: 0.82rem;
  color: #a08bc0;
  margin-bottom: 28px;
}

/* ========================================
   Forms
======================================== */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #4a3a5c;
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e0d4f0;
  border-radius: 10px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 0.93rem;
  color: #4a3a5c;
  background: #faf8ff;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #7c4dff;
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.12);
  background: #fff;
}

.form-group textarea {
  resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #c4b8d8;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

/* ========================================
   Buttons
======================================== */
.btn-submit {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  background: linear-gradient(135deg, #7c4dff, #6a3de8);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(124, 77, 255, 0.3);
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(124, 77, 255, 0.4);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ========================================
   Input Tabs
======================================== */
.input-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid #e0d4f0;
}

.input-tab {
  flex: 1;
  padding: 10px;
  background: #faf8ff;
  color: #a090b8;
  border: none;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.input-tab + .input-tab {
  border-left: 1.5px solid #e0d4f0;
}

.input-tab.active {
  background: linear-gradient(135deg, #7c4dff, #6a3de8);
  color: #fff;
}

.input-tab:hover:not(.active) {
  background: #f0ecf8;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #4a3a5c;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #7c4dff;
  cursor: pointer;
}

/* Reishi result text - taller for longer content */
.reishi-result-text {
  max-height: 75vh;
}

/* ========================================
   Memo Card
======================================== */
.memo-card {
  margin-bottom: 16px;
  border: 1.5px solid #d8cceb;
  background: #faf8ff;
}

.memo-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #5b3d8a;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #e0d4f0;
}

.memo-text {
  white-space: pre-wrap;
  font-size: 0.88rem;
  line-height: 1.75;
  color: #4a3a5c;
}

#kantei-card {
  margin-top: 0;
}

/* ========================================
   Feedback Card
======================================== */
.feedback-card {
  margin-top: 16px;
  border: 1.5px solid #e0d4f0;
}

.feedback-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #5b3d8a;
  margin-bottom: 10px;
}

.feedback-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e0d4f0;
  border-radius: 10px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 0.92rem;
  color: #4a3a5c;
  background: #faf8ff;
  resize: vertical;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.feedback-input:focus {
  outline: none;
  border-color: #7c4dff;
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.12);
  background: #fff;
}

.feedback-input::placeholder {
  color: #c4b8d8;
  font-size: 0.85rem;
}

.btn-regenerate {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  background: linear-gradient(135deg, #ff8a65, #f4683a);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(244, 104, 58, 0.25);
}

.btn-regenerate:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(244, 104, 58, 0.35);
}

.btn-regenerate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ========================================
   Back / Top Button
======================================== */
.btn-top {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: #fff;
  color: #8a7a9e;
  border: 1.5px solid #e0d4f0;
  border-radius: 10px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-top:hover {
  background: #f5f0fa;
  color: #5b3d8a;
  border-color: #c8b8e0;
}

/* ========================================
   Loading Screen
======================================== */
.loading-card {
  text-align: center;
  padding: 60px 24px;
  background: #fff;
}

.loading-animation {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 32px;
}

.crystal {
  font-size: 3rem;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.15); }
}

.sparkle {
  position: absolute;
  font-size: 1.2rem;
  animation: twinkle 1.5s ease-in-out infinite;
}

.sparkle-1 { top: 0; left: 50%; animation-delay: 0s; }
.sparkle-2 { top: 20%; right: 5%; animation-delay: 0.3s; }
.sparkle-3 { bottom: 20%; right: 5%; animation-delay: 0.6s; }
.sparkle-4 { bottom: 0; left: 50%; animation-delay: 0.9s; }
.sparkle-5 { bottom: 20%; left: 5%; animation-delay: 1.2s; }
.sparkle-6 { top: 20%; left: 5%; animation-delay: 0.4s; }

@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.loading-text {
  font-size: 1rem;
  color: #5b3d8a;
  font-weight: 500;
  animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ========================================
   Result Screen
======================================== */
.result-title {
  text-align: center;
  font-size: 1.3rem;
  color: #3a1d6e;
  margin-bottom: 20px;
}

.result-text {
  white-space: pre-wrap;
  line-height: 1.85;
  font-size: 0.92rem;
  color: #4a3a5c;
  padding: 20px;
  background: linear-gradient(135deg, #faf8ff, #fff8fb);
  border-radius: 12px;
  border: 1px solid #e8daf3;
  margin-bottom: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.result-actions {
  display: flex;
  gap: 12px;
}

.btn-copy,
.btn-retry {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-copy {
  background: linear-gradient(135deg, #7c4dff, #6a3de8);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(124, 77, 255, 0.25);
}

.btn-copy:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 77, 255, 0.35);
}

.btn-retry {
  background: #fff;
  color: #7c4dff;
  border: 1.5px solid #e0d4f0;
}

.btn-retry:hover {
  background: #f5f0fa;
  transform: translateY(-2px);
}

.copy-feedback {
  text-align: center;
  margin-top: 12px;
  padding: 8px;
  background: #e8f8e8;
  color: #3a8a3a;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  display: none;
}

.copy-feedback.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Scrollbar */
.result-text::-webkit-scrollbar {
  width: 6px;
}

.result-text::-webkit-scrollbar-track {
  background: transparent;
}

.result-text::-webkit-scrollbar-thumb {
  background: #d4c4e8;
  border-radius: 3px;
}

/* ========================================
   Settings
======================================== */
.settings-group {
  margin-bottom: 18px;
}

.settings-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #4a3a5c;
  margin-bottom: 6px;
}

.settings-group input,
.settings-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e0d4f0;
  border-radius: 10px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 0.88rem;
  color: #4a3a5c;
  background: #faf8ff;
  transition: border-color 0.3s, box-shadow 0.3s;
  resize: vertical;
}

.settings-group input:focus,
.settings-group textarea:focus {
  outline: none;
  border-color: #7c4dff;
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.12);
  background: #fff;
}

.settings-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #3a1d6e;
  margin-top: 28px;
  margin-bottom: 16px;
  padding-top: 20px;
  border-top: 2px solid rgba(124, 77, 255, 0.12);
}

.settings-hint {
  font-size: 0.76rem;
  color: #a898be;
  margin-top: 4px;
}

.settings-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.settings-actions .btn-submit {
  flex: 1;
  margin-top: 0;
}

.btn-settings-reset {
  flex: 1;
  padding: 14px;
  background: #fff;
  color: #7c4dff;
  border: 1.5px solid #e0d4f0;
  border-radius: 12px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.btn-settings-reset:hover {
  background: #f5f0fa;
  transform: translateY(-2px);
}

.settings-feedback {
  text-align: center;
  margin-top: 12px;
  padding: 8px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  display: none;
}

.settings-feedback.show {
  display: block;
  animation: fadeIn 0.3s ease;
  background: #e8f8e8;
  color: #3a8a3a;
}

.settings-feedback.error {
  background: #f8e8e8;
  color: #8c4a4a;
}

/* ========================================
   Responsive
======================================== */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .hamburger {
    display: flex;
  }

  .main-content {
    margin-left: 0;
  }

  .page {
    padding: 24px 16px;
    padding-top: 72px;
  }

  .dashboard-grid,
  .gen-menu-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-bg-img,
  .dashboard-bg-overlay {
    left: 0;
    width: 100%;
  }

  .welcome-title {
    font-size: 1.05rem;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 24px 16px;
  }

  .title {
    font-size: 1.25rem;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .page {
    padding: 16px 12px;
    padding-top: 68px;
  }
}

/* ========================================
   PDF Settings
======================================== */
.pdf-bg-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .pdf-bg-section {
    grid-template-columns: 1fr;
  }
}

.pdf-bg-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
}

.pdf-bg-preview {
  width: 100%;
  aspect-ratio: 210 / 297;
  max-height: 240px;
  border: 2px dashed #c4b5d9;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f8f5fc;
  margin-bottom: 10px;
}

.pdf-bg-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pdf-bg-placeholder {
  color: #a090b8;
  font-size: 14px;
}

.pdf-bg-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.pdf-bg-actions select {
  flex: 1;
  min-width: 100px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #d0c5e0;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 13px;
  background: #fff;
}

.btn-upload-label {
  display: inline-block;
  padding: 8px 14px;
  background: linear-gradient(135deg, #7c4dff, #6a3de8);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Zen Maru Gothic', sans-serif;
  transition: transform 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.btn-upload-label:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 77, 255, 0.3);
}

.btn-small-danger {
  padding: 6px 12px;
  background: #fff;
  color: #e74c6f;
  border: 1px solid #e74c6f;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Zen Maru Gothic', sans-serif;
  transition: all 0.2s;
}

.btn-small-danger:hover {
  background: #e74c6f;
  color: #fff;
}

.pdf-font-section {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.pdf-font-section .form-group {
  flex: 1;
  min-width: 200px;
}

.pdf-layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.pdf-layout-grid .form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 14px;
}

.pdf-layout-grid input[type="number"],
.pdf-layout-grid input[type="color"] {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #d0c5e0;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 14px;
  background: #fff;
}

.pdf-layout-grid input[type="color"] {
  height: 40px;
  cursor: pointer;
}

.pdf-settings-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.pdf-settings-actions .btn-submit,
.pdf-settings-actions .btn-copy {
  flex: 1;
  min-width: 160px;
}

/* PDF Settings Preview */
.pdf-settings-preview-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.pdf-settings-preview-controls .btn-small {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid #d1c4e9;
  background: #f5f0ff;
  color: #5a4a6e;
  cursor: pointer;
  transition: background 0.2s;
}

.pdf-settings-preview-controls .btn-small:hover:not(:disabled) {
  background: #ede4ff;
}

.pdf-settings-preview-controls .btn-small:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#pdf-preview-page-info {
  font-size: 13px;
  color: #8a7a9e;
  min-width: 50px;
  text-align: center;
}

.pdf-settings-preview-area {
  background: #f0eaf5;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  justify-content: center;
  overflow: auto;
  max-height: 600px;
}

.pdf-settings-preview-area canvas {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(90, 60, 120, 0.15);
}

/* ========================================
   Test Mode
======================================== */
.test-mode-toggle {
  font-size: 14px;
  color: #8a7a9e;
}

.test-mode-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 10px;
  margin-bottom: 12px;
}

.test-mode-badge {
  font-size: 13px;
  font-weight: 700;
  color: #f57f17;
  background: #fff3c4;
  padding: 4px 10px;
  border-radius: 6px;
}

.test-mode-next {
  padding: 6px 14px;
  background: #fff;
  border: 1px solid #ffe082;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Zen Maru Gothic', sans-serif;
  color: #f57f17;
  transition: all 0.2s;
}

.test-mode-next:hover {
  background: #fff8e1;
}

.test-mode-active {
  background: #fffdf5 !important;
  border: 2px solid #ffe082 !important;
}

.required {
  color: #e74c6f;
  font-size: 12px;
}

/* ========================================
   Reishi Tabs
======================================== */
.reishi-tabs {
  display: flex;
  gap: 4px;
  padding: 4px 20px 0;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.reishi-tab {
  padding: 12px 16px;
  background: #e8e0f0;
  color: #6a5a7e;
  border: none;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  min-height: 44px;
  flex: 1 1 auto;
  text-align: center;
}

.reishi-tab:hover:not(:disabled) {
  background: #d8cee8;
}

.reishi-tab.active {
  background: #fff;
  color: #4a3a5c;
  font-weight: 700;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.reishi-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.reishi-tab-content {
  display: none;
}

.reishi-tab-content.active {
  display: block;
}

.reishi-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(240, 236, 245, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Result textarea (editable) */
.result-textarea {
  width: 100%;
  min-height: 300px;
  padding: 16px;
  border: 1px solid #d0c5e0;
  border-radius: 10px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 14px;
  line-height: 1.8;
  color: #4a3a5c;
  background: #fff;
  resize: vertical;
}

.result-textarea:focus {
  outline: none;
  border-color: #7c4dff;
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.1);
}

/* PDF Preview Layout */
.pdf-preview-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .pdf-preview-layout {
    grid-template-columns: 1fr;
  }
}

.pdf-preview-left h3,
.pdf-preview-right h3 {
  margin-bottom: 12px;
  font-size: 16px;
  color: #4a3a5c;
}

.pdf-preview-area {
  background: #f8f5fc;
  border: 2px dashed #c4b5d9;
  border-radius: 10px;
  min-height: 500px;
  padding: 16px;
  overflow-y: auto;
  max-height: 80vh;
}

.pdf-preview-area img {
  width: 100%;
  margin-bottom: 12px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pdf-preview-placeholder {
  color: #a090b8;
  text-align: center;
  padding-top: 200px;
}

/* PDF download button */
.btn-pdf {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  background: linear-gradient(135deg, #e74c6f, #d4326a);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(231, 76, 111, 0.25);
}

.btn-pdf:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(231, 76, 111, 0.35);
}

.btn-pdf:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ========================================
   Analytics / API Usage Monitor
======================================== */
.analytics-period-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.analytics-period-btn {
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid #d1c4e9;
  background: #f5f0ff;
  color: #5a4a6e;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.analytics-period-btn.active {
  background: #7c4dff;
  color: #fff;
  border-color: #7c4dff;
}

.analytics-period-btn:hover:not(.active) {
  background: #ede4ff;
}

.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.analytics-summary-card {
  background: linear-gradient(135deg, #f8f4ff 0%, #ede4ff 100%);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  border: 1px solid #e0d4f5;
}

.analytics-summary-label {
  font-size: 12px;
  color: #8a7a9e;
  margin-bottom: 6px;
  font-weight: 500;
}

.analytics-summary-value {
  font-size: 22px;
  font-weight: 700;
  color: #5a3e8e;
}

.analytics-alerts {
  margin-bottom: 16px;
}

.analytics-alert-item {
  background: #fff3e0;
  border: 1px solid #ffb74d;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #e65100;
  display: flex;
  align-items: center;
  gap: 8px;
}

.analytics-chart-container {
  position: relative;
  width: 100%;
  height: 280px;
}

.analytics-chart-small {
  height: 220px;
}

.analytics-chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .analytics-chart-row {
    grid-template-columns: 1fr;
  }
}

.analytics-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.analytics-table th {
  background: #f5f0ff;
  color: #5a4a6e;
  font-weight: 600;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid #e0d4f5;
  white-space: nowrap;
}

.analytics-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #f0eaf5;
  color: #4a3a5e;
  white-space: nowrap;
}

.analytics-table tbody tr:hover {
  background: #faf8ff;
}

/* ========================================
   Analytics Tabs (タブ切り替え)
======================================== */
.analytics-tabs {
  display: flex;
  gap: 4px;
  padding: 4px 20px 0;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.analytics-tab {
  padding: 12px 16px;
  background: #e8e0f0;
  color: #6a5a7e;
  border: none;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  min-height: 44px;
  flex: 1 1 auto;
  text-align: center;
}

.analytics-tab:hover {
  background: #d8cee8;
}

.analytics-tab.active {
  background: #fff;
  color: #4a3a5c;
  font-weight: 700;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.analytics-tab-content {
  display: none;
}

.analytics-tab-content.active {
  display: block;
}

/* Coming Soon Cards */
.coming-soon-card {
  text-align: center;
  padding: 48px 24px;
}

.coming-soon-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 8px rgba(180, 140, 255, 0.3));
}

.coming-soon-title {
  font-size: 1.3rem;
  color: #4a3a5c;
  margin-bottom: 12px;
}

.coming-soon-desc {
  color: #8a7a9e;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.coming-soon-list {
  list-style: none;
  text-align: left;
  max-width: 320px;
  margin: 0 auto 24px;
}

.coming-soon-list li {
  padding: 8px 0;
  color: #6a5a7e;
  font-size: 0.9rem;
  border-bottom: 1px solid #f0ecf5;
}

.coming-soon-list li::before {
  content: '✦ ';
  color: #b48cff;
}

.coming-soon-badge {
  display: inline-block;
  background: linear-gradient(135deg, #e8dff5, #d8cee8);
  color: #7a6a9e;
  padding: 6px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ========================================
   Rich Editor (contenteditable)
   ======================================== */
.rich-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #f7f4fb;
  border: 1px solid #d0c5e0;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
}

.rich-editor-color-btn {
  width: 32px;
  height: 32px;
  border: 2px solid #d0c5e0;
  border-radius: 6px;
  background: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1;
}

.rich-editor-color-btn:hover {
  border-color: #7c4dff;
}

.rich-editor-color-btn.active {
  border-color: #7c4dff;
  box-shadow: 0 0 0 2px rgba(124, 77, 255, 0.25);
}

.rich-editor-color-default { color: #4a3a5c; }
.rich-editor-color-orange  { color: #e67e22; }
.rich-editor-color-red     { color: #e74c3c; }

.rich-editor-toolbar-sep {
  width: 1px;
  height: 24px;
  background: #d0c5e0;
  margin: 0 4px;
}

.rich-editor-action-btn {
  padding: 4px 12px;
  border: 1px solid #d0c5e0;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  color: #7a6a9e;
  cursor: pointer;
  transition: background 0.15s;
}

.rich-editor-action-btn:hover {
  background: #f0ecf5;
}

.rich-editor-area {
  width: 100%;
  min-height: 300px;
  max-height: 600px;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid #d0c5e0;
  border-radius: 0 0 10px 10px;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 14px;
  line-height: 1.8;
  color: #4a3a5c;
  background: #fff;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.rich-editor-area:focus {
  outline: none;
  border-color: #7c4dff;
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.1);
}

.rich-editor-area:empty::before {
  content: '鑑定結果テキストがここに表示されます';
  color: #b0a0c0;
  pointer-events: none;
}
