:root {
  --primary: #2563eb;
  --secondary: #0ea5e9;
  --bg-color: #f1f5f9;
  --panel-bg: rgba(255, 255, 255, 0.95);
  --text-main: #1e293b;
  --stamina-full: #10b981;
  --stamina-low: #ef4444;
  --wave: #0284c7;
  --reef: #3f3f46;
}

* { box-sizing: border-box; font-family: 'Noto Sans JP', sans-serif; }
body { margin: 0; padding: 0; display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; background: var(--bg-color); color: var(--text-main); }
.app-container { width: 100%; max-width: 480px; padding: 20px; display: flex; flex-direction: column; align-items: center; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); background: var(--panel-bg); }

/* Header & HUD */
.back-link { margin-bottom: 20px; align-self: flex-start; font-size: 0.8rem; text-decoration: none; color: #64748b; font-weight: 600; display: flex; align-items: center; gap: 0.3rem; transition: color 0.2s; }
.back-link:hover { color: var(--primary); }
.game-header { text-align: center; margin-bottom: 20px; }
.header-icon { font-size: 2.2rem; margin-bottom: 8px; background: linear-gradient(135deg, #38bdf8, #2563eb); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 4px 6px rgba(37,99,235,0.2)); }
.game-title-jp { font-size: 0.95rem; font-weight: 700; color: var(--primary); margin: 0; letter-spacing: 1px; }
.game-header h1 { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 2.4rem; line-height: 1.1; margin: 5px 0 0; color: #0f172a; }
.game-header span { color: var(--primary); font-family: 'Outfit', sans-serif; }
.game-desc { font-size: 0.85rem; color: #64748b; margin-top: 8px; margin-bottom: 0; }

/* HUD */
.hud { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.score-display { font-size: 1.2rem; font-weight: 700; color: #0f172a; }
.score-display span { font-size: 1.5rem; color: var(--primary); }
.stamina-container { width: 50%; display: flex; flex-direction: column; align-items: flex-end; }
.stamina-label { font-size: 0.75rem; font-weight: 700; margin-bottom: 2px; color: #64748b; }
.stamina-bar-bg { width: 100%; height: 12px; background: #e2e8f0; border-radius: 6px; overflow: hidden; }
.stamina-bar-fill { height: 100%; width: 100%; background: var(--stamina-full); transition: width 0.1s linear, background-color 0.3s; }

/* PR Notice */
.pr-notice {
  text-align: center;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 1.5rem;
  padding: 0.5rem;
  background: rgba(248, 250, 252, 0.5);
  border-radius: 8px;
  width: 100%;
}

/* Canvas Area */
.canvas-wrapper { position: relative; width: 100%; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.1); border: 4px solid var(--primary); }
canvas { display: block; width: 100%; background: linear-gradient(to bottom, #7dd3fc 0%, #0369a1 40%, #082f49 100%); }
.canvas-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.85); display: flex; flex-direction: column; justify-content: center; align-items: center; color: white; text-align: center; z-index: 10; padding: 20px; }
.canvas-overlay h2 { margin-bottom: 10px; font-size: 1.5rem; color: #38bdf8; }
.rule-text { font-size: 0.85rem; line-height: 1.6; margin-bottom: 20px; color: #cbd5e1; }
.rule-text strong { color: #facc15; }

/* Controls */
.controls-area { margin-top: 20px; width: 100%; }
.dive-btn { width: 100%; padding: 20px; font-size: 1.3rem; font-weight: 700; border-radius: 15px; border: none; cursor: pointer; color: white; background: #dc2626; box-shadow: 0 10px 0 #991b1b, 0 15px 20px rgba(220, 38, 38, 0.4); transition: transform 0.1s, box-shadow 0.1s; user-select: none; }
.dive-btn:active, .dive-btn.pressed { transform: translateY(10px); box-shadow: 0 0px 0 #991b1b, 0 5px 10px rgba(220, 38, 38, 0.4); }
.dive-btn.disabled { background: #94a3b8; box-shadow: 0 10px 0 #64748b; cursor: not-allowed; opacity: 0.8; }
.dive-btn.disabled:active { transform: none; box-shadow: 0 10px 0 #64748b; }

/* Modal */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 100; padding: 20px; }
.hidden { display: none !important; }
.modal-content { background: white; padding: 30px 20px; border-radius: 20px; width: 100%; max-width: 400px; text-align: center; }
.game-over-title { color: #dc2626; font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 2rem; margin-top: 0; margin-bottom: 10px; }
.result-score { font-size: 1.2rem; margin-bottom: 20px; color: #334155; }
.result-score strong { font-size: 1.6rem; color: var(--primary); }
.cause-box { background: #fef2f2; border: 2px dashed #f87171; border-radius: 10px; padding: 10px; margin-bottom: 20px; }
.cause-label { font-size: 0.75rem; color: #ef4444; font-weight: bold; margin-bottom: 5px; }
.cause-text { font-size: 1rem; font-weight: 700; color: #991b1b; }

/* Affiliate Styles inside Modal */
.affiliate-title-heading { font-size: 1rem; color: #475569; margin: 0 0 10px 0; border-bottom: 2px solid #e2e8f0; padding-bottom: 5px; }
.affiliate-card { display: flex; align-items: center; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; margin-bottom: 12px; background: #f8fafc; text-align: left; position: relative; }
.affiliate-image { font-size: 2rem; width: 50px; height: 50px; background: white; border-radius: 8px; display: flex; justify-content: center; align-items: center; color: var(--primary); box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-right: 15px; flex-shrink: 0; }
.affiliate-text { display: flex; flex-direction: column; flex: 1; }
.affiliate-push { font-size: 0.7rem; font-weight: 700; color: var(--primary); margin-bottom: 3px; }
.affiliate-title { font-size: 0.9rem; font-weight: 700; color: #1e293b; line-height: 1.3; margin-bottom: 8px; }
.affiliate-title a { color: inherit; text-decoration: none; }
.a8-card::after { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 10; }
.affiliate-buttons { display: flex; gap: 8px; position: relative; z-index: 20; }
.btn-amazon, .btn-rakuten { flex: 1; text-align: center; padding: 8px 5px; font-size: 0.75rem; font-weight: 700; color: white !important; border-radius: 6px; text-decoration: none !important; }
.btn-amazon { background: #f59e0b; }
.btn-rakuten { background: #bf0000; }

.modal-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; position: relative; z-index: 20;}
.btn-share { padding: 12px; font-size: 1rem; border-radius: 10px; border: none; background: #000; color: white; cursor: pointer; font-weight: bold; }
.btn-primary { padding: 15px; font-size: 1.1rem; border-radius: 10px; border: none; background: var(--primary); color: white; cursor: pointer; font-weight: bold; }

@media (max-width: 400px) {
  canvas { height: 350px; }
}

/* Ranking Styles */
.ranking-list { list-style: none; padding: 0; margin: 0; text-align: left; }
.ranking-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; border-bottom: 1px solid #e2e8f0; font-size: 1.1rem; }
.ranking-list li:nth-child(even) { background: #f8fafc; }
.ranking-list li.rank-1 { font-size: 1.5rem; font-weight: 800; color: #b45309; background: #fef08a; border-bottom: 2px solid #fde047; }
.ranking-list li.rank-2 { font-size: 1.25rem; font-weight: 700; color: #475569; background: #f1f5f9; }
.ranking-list li.rank-3 { font-size: 1.15rem; font-weight: 700; color: #9a3412; background: #ffedd5; }
.rank-icon { margin-right: 12px; font-size: 1.2em; }
.ranking-info { display: flex; flex-direction: column; flex-grow: 1; text-align: left; }
.ranking-name { font-weight: bold; color: #334155; }
.rank-1 .ranking-name { color: #b45309; }
.rank-2 .ranking-name { color: #475569; }
.rank-3 .ranking-name { color: #9a3412; }
.ranking-date { font-size: 0.75rem; color: #94a3b8; font-weight: normal; margin-top: 2px; }
.ranking-score { font-weight: 800; font-size: 1.3em; color: #0284c7; }

/* Premium Comments Section */
.premium-comments-section {
  margin: 30px 0 10px 0;
  padding: 24px 20px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255,255,255,1);
}

.premium-comments-section h2 {
  color: transparent;
  background: linear-gradient(135deg, #10b981, #059669);
  -webkit-background-clip: text;
  background-clip: text;
  margin: 0 0 5px 0;
  font-size: 1.3rem;
  text-align: center;
  font-weight: 800;
  letter-spacing: 1px;
}

.premium-comments-section .section-sub {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0 0 20px 0;
  text-align: center;
  font-weight: 600;
}

.comments-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Custom Scrollbar */
.comments-list::-webkit-scrollbar { width: 6px; }
.comments-list::-webkit-scrollbar-track { background: rgba(226, 232, 240, 0.5); border-radius: 10px; }
.comments-list::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.5); border-radius: 10px; }
.comments-list::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.8); }

.comment-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  font-size: 0.95rem;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.comment-item:hover { transform: translateY(-2px); }

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  padding: 0 5px;
}

.comment-name {
  font-weight: 700;
  color: #1e293b;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
}

.comment-name i { color: #cbd5e1; margin-right: 6px; font-size: 1.1rem; }
.comment-date { font-size: 0.75rem; color: #94a3b8; font-weight: 600; }

.comment-score-badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 700;
  margin-left: 8px;
  letter-spacing: 0.5px;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-fail { background: #fee2e2; color: #991b1b; }
.vol-badge { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.dolphin-badge { background: #fef3c7; color: #d97706; border: 1px solid #fde68a; }

.comment-bubble {
  position: relative;
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  padding: 12px 15px;
  border-radius: 14px;
  color: #334155;
  line-height: 1.5;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-top-left-radius: 4px;
  margin-left: 8px;
  font-size: 0.95rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.02);
  word-break: break-all;
}

.comment-bubble::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -8px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-left: 1px solid rgba(226, 232, 240, 0.8);
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  transform: skewX(-15deg);
  border-bottom-right-radius: 4px;
}
