:root {
  --primary: #7c3aed;
  --primary-dark: #4c1d95;
  --secondary: #c026d3;
  --accent: #fbbf24;
  --accent-dark: #d97706;
  --bg: #0b1020;
  --bg-alt: #131a36;
  --bg-card: #1a2148;
  --bg-card-2: #222a5a;
  --text: #f1f5f9;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;
  --border: rgba(148, 163, 184, 0.2);
  --border-strong: rgba(251, 191, 36, 0.45);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

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

html, body {
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Yu Gothic UI', 'Noto Sans JP', 'Segoe UI', Roboto, sans-serif;
  background: #0b1020;
  background-image:
    radial-gradient(ellipse at top, #1e1b4b 0%, transparent 55%),
    radial-gradient(ellipse at bottom right, #312e81 0%, transparent 55%),
    linear-gradient(180deg, #0b1020 0%, #0f172a 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
}

/* ===== 星空背景(控えめ) ===== */
.stars {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0.55;
}

.stars-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 200%;
  background-repeat: repeat;
}

.stars-1 {
  background-image: radial-gradient(1px 1px at 20px 30px, #fff, transparent),
                    radial-gradient(1px 1px at 40px 70px, #cbd5e1, transparent),
                    radial-gradient(1px 1px at 130px 80px, #fff, transparent);
  background-size: 200px 200px;
  animation: starsMove 200s linear infinite;
  opacity: 0.5;
}

.stars-2 {
  background-image: radial-gradient(1.5px 1.5px at 50px 60px, #fff, transparent),
                    radial-gradient(1px 1px at 180px 30px, #fbbf24, transparent);
  background-size: 280px 280px;
  animation: starsMove 300s linear infinite;
  opacity: 0.35;
}

.stars-3 { display: none; }
.shooting-star { display: none; }

@keyframes starsMove {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}

/* ===== ヘッダー ===== */
.site-header {
  position: relative;
  z-index: 2;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}

.header-hero {
  position: relative;
  width: 100%;
  height: 240px;
  overflow: hidden;
  background: #0b1020;
}

.header-hero-img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.45;
}

.header-hero-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at center, rgba(11, 16, 32, 0.3) 0%, rgba(11, 16, 32, 0.85) 100%),
    linear-gradient(180deg, rgba(11, 16, 32, 0.4) 0%, rgba(11, 16, 32, 0.95) 100%);
}

.header-hero-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1rem;
}

.site-title {
  font-family: 'Cinzel', 'Noto Serif JP', 'Yu Mincho', serif;
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 0;
}

.site-title a {
  color: #fff;
  text-decoration: none;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.title-icon {
  display: inline-block;
  margin-right: 0.3rem;
}

.site-tagline {
  margin-top: 0.85rem;
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: 0.18em;
  font-weight: 500;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.header-inner {
  background: rgba(11, 16, 32, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.site-nav {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  align-items: center;
  justify-content: center;
}

.site-nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.site-nav a:hover {
  background: rgba(124, 58, 237, 0.2);
  border-color: rgba(167, 139, 250, 0.4);
  color: #fff;
}

.user-name {
  color: var(--accent);
  font-size: 0.9rem;
  padding: 0.3rem 0.7rem;
  font-weight: 500;
}

.logout-link {
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}
.logout-link:hover {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  color: #fff !important;
}

.register-link {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%) !important;
  color: #1a1a2e !important;
  border-color: transparent !important;
  font-weight: 700 !important;
}
.register-link:hover {
  background: linear-gradient(135deg, #fcd34d 0%, var(--accent) 100%) !important;
  color: #0b1020 !important;
}

/* ===== メイン ===== */
.site-main, main {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 2.5rem auto;
  padding: 0 1.25rem;
}

h1, h2, h3, h4 {
  color: #fff;
  font-weight: 700;
  line-height: 1.35;
}

h2 {
  font-family: 'Noto Serif JP', 'Yu Mincho', serif;
  font-size: 1.6rem;
  margin-bottom: 1.25rem;
  letter-spacing: 0.05em;
  padding-left: 0.9rem;
  border-left: 4px solid var(--accent);
}

h3 {
  color: var(--accent);
  margin: 1rem 0 0.6rem;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  font-weight: 600;
}

p, li, td, th, label {
  color: var(--text);
}

p {
  margin-bottom: 0.6rem;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(167, 139, 250, 0.35);
}

.card-highlight {
  background: linear-gradient(135deg, #1f2553 0%, #2a1f5a 100%);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(251, 191, 36, 0.15);
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: #0f1530;
  color: #fff;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input::placeholder, textarea::placeholder { color: var(--text-dim); }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18);
  background: #131a36;
}

button,
.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 0.78rem 1.6rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.98rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

button:hover,
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.5);
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
}

button:active, .btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  box-shadow: none;
}
.btn-secondary:hover {
  background: rgba(251, 191, 36, 0.12);
  box-shadow: none;
  color: #fcd34d;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}
.btn-danger:hover {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.5);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

th, td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

th {
  background: #1c2452;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.03em;
  font-size: 0.88rem;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(124, 58, 237, 0.08); }

.alert {
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border-left: 4px solid;
  font-size: 0.95rem;
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--danger);
  color: #fecaca;
}

.alert-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--success);
  color: #a7f3d0;
}

.alert-info {
  background: rgba(59, 130, 246, 0.12);
  border-color: var(--info);
  color: #bfdbfe;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--warning);
  color: #fde68a;
}

.score-big {
  font-family: 'Cinzel', 'Noto Serif JP', serif;
  font-size: 4.5rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  line-height: 1;
  text-shadow:
    0 2px 4px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(251, 191, 36, 0.35);
  margin: 0.5rem 0;
}

.score-label {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.chart-container {
  position: relative;
  height: 350px;
  margin: 1rem 0;
}

.chart-container-small {
  position: relative;
  height: 250px;
}

.lucky-box {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #1a1a2e;
  padding: 0.5rem 1.1rem;
  border-radius: 6px;
  font-weight: 700;
  margin: 0.3rem 0.3rem 0.3rem 0;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

.comment-bubble {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(192, 38, 211, 0.12) 100%);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem 1.4rem 2.4rem;
  font-size: 1.05rem;
  position: relative;
  color: #fef3c7;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  line-height: 1.8;
}

.comment-bubble::before {
  content: '"';
  position: absolute;
  top: 0.3rem;
  left: 0.9rem;
  color: var(--accent);
  font-size: 2.5rem;
  font-family: Georgia, serif;
  line-height: 1;
  opacity: 0.7;
}

.basis-note {
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid var(--info);
  padding: 0.75rem 0.95rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  border-radius: 6px;
  margin-top: 0.5rem;
}

.score-bar {
  background: #0f1530;
  height: 22px;
  border-radius: 11px;
  overflow: hidden;
  margin: 0.4rem 0;
  border: 1px solid var(--border);
}

.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: #fff;
  padding-right: 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 11px;
  transition: width 0.6s ease-out;
}

.nav-links {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.nav-links a {
  flex: 1;
  min-width: 150px;
  text-align: center;
  padding: 1rem 1.1rem;
  background: var(--bg-card-2);
  color: var(--accent);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-weight: 600;
  letter-spacing: 0.03em;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.nav-links a:hover {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 3rem;
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  background: rgba(11, 16, 32, 0.7);
  backdrop-filter: blur(8px);
}

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

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  letter-spacing: 0.03em;
}

.badge-success { background: var(--success); }
.badge-danger  { background: var(--danger); }
.badge-warning { background: var(--warning); color: #1a1a2e; }
.badge-info    { background: var(--info); }

a {
  color: var(--accent);
  transition: color 0.2s;
}

a:hover {
  color: #fcd34d;
}

/* スクロールバー */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0b1020; }
::-webkit-scrollbar-thumb { background: #2a3160; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3a4380; }

@media (max-width: 768px) {
  body { font-size: 15px; }
  .header-hero { height: 180px; }
  .site-title { font-size: 1.7rem; letter-spacing: 0.08em; }
  .site-tagline { font-size: 0.82rem; letter-spacing: 0.12em; }
  main { padding: 0 0.85rem; margin: 1.5rem auto; }
  .score-big { font-size: 3rem; }
  .site-nav { gap: 0.25rem; padding: 0.5rem; }
  .site-nav a { font-size: 0.82rem; padding: 0.45rem 0.7rem; }
  h2 { font-size: 1.3rem; }
  .card { padding: 1.2rem; }
}
