/* --------------------------
   Reset & Base
   -------------------------- */
* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

:root{
  --bg: #0f1724;
  --text: #dadada;
  --card: #0b1220;
  --muted: #98a0b3;
  --accent1: #6a11cb;
  --accent2: #2575fc;
  --glass: rgba(255,255,255,0.04);
  --glass-2: rgba(255,255,255,0.02);
  --success: #22c55e;
  --danger: #ef4444;
  --button1: #030303;
  --button2: #000;
  --per: #dbdbdb;
}

body.light {
  --bg: #ffffff;
  --text: #181818;
  --card: #fafafa;
  --muted: #98a0b3;
  --accent1: #6a11cb;
  --accent2: #2575fc;
  --glass: rgba(0, 0, 0, 0.04);
  --glass-2: rgba(0, 0, 0, 0.02);
  --success: #22c55e;
  --danger: #ff4040;
  --button1: #ebebeb;
  --button2: #f0f0f0;
  --per: #8a8a8a;
}

html,body { 
  height: 100%; 
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; 
  background: var(--bg); 
  color: var(--text); 
  -webkit-font-smoothing: antialiased; 
}

/* --------------------------
   Page container + header
   -------------------------- */
.container {
  max-width: 1200px;
  margin: 0px auto;
  padding: 20px;
  display:  flex;
  flex-direction: column;
  gap: 18px;
  background-color: var(--bg);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--glass);
  border-radius: 12px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.03);
}

header h1 {
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Primary header buttons */
.header-buttons button {
  background: linear-gradient(135deg,var(--accent1),var(--accent2));
  border: none;
  color: white;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(37,117,252,0.12);
  transition: transform .12s ease, opacity .12s ease;
}

.header-buttons button:hover { 
  transform: translateY(-2px); 
  opacity:0.98; 
}

.header-buttons button:active { 
  transform: translateY(0); 
}

/* --------------------------
   Character selector row
   -------------------------- */
.character-selector {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--glass);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.03);
}

.character-selector label { 
  color: var(--muted); 
  font-weight: 600; 
  margin-right: 6px; 
}

.character-selector select {
  min-width: 220px;
  padding: 12px 15px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  background: var(--glass);
  color: var(--text);
}

#type-select {
  background-color: var(--card);
  color: var(--text);
}

#subclass-select {
  background-color: var(--card);
  color: var(--text);
}

.character-selector button {
  background: transparent;
  color: #ffd6d6;
  border: 1px solid rgba(255,255,255,0.03);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.character-selector button:hover { 
  background: rgba(255,255,255,0.02); 
}

#delete-character-btn {
  background-color: var(--danger) !important;
  color: var(--bg);
}

#stats-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

/* Stat row wrapper (primary or secondary) */
.stat-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: stretch;
}

/* Individual stat box */
.stat-box {
  flex: 1 1 150px;
  min-width: 140px;
  background: linear-gradient(180deg,var(--card), var(--bg));
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
}

/* stat title */
.stat-box h3 {
  font-size: 0.95rem;
  color: #dfe8fb;
  text-transform: capitalize;
  letter-spacing: 0.01em;
}

/* baseline / add / total */
.stat-title { 
  font-size: 1.3rem; 
  font-weight: 700;
}

.stat-value { 
  font-size: 1.2rem; 
  color: var(--muted); 
}

.stat-add { 
  font-size: 1.1rem; 
  color: var(--success); 
  font-weight: 700; 
}

.stat-total { 
  font-size: 1.3rem; 
  font-weight: 500; 
  color: var(--text); 
}

/* Buttons under stat */
.stat-buttons {
  display: flex;
  gap: 8px;
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.stat-buttons button {
  flex: 1 1 44%;
  padding: 8px 0;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 17px;
  font-weight:700;
  background: linear-gradient(200deg, var(--button1), var(--button2));
  color: var(--text);
  transition: transform .2s ease;
}

.stat-buttons button:hover { 
    transform:translateY(-2px); 
    background: linear-gradient(200deg, rgba(255,255,255,0.12), rgba(255,255,255,0.03));
}

.stat-buttons button:active { 
  transform:none; 
}

/* Provide a small visual guide for baseline / add / total */
.stat-values-wrapper { 
  width: 100%; 
  display: flex; 
  flex-direction: column; 
  gap: 4px; 
  align-items: center; 
}

.stat-set {
  background: var(--danger) !important;
  color: var(--bg) !important;
  font-size: 13px !important;
}

/* Horizontal separator between primary and secondary */
#stats-container > hr, .stat-row + hr { 
  border:0; 
  border-top:1px solid rgba(255,255,255,0.04); 
  width:100%; 
  margin:6px 0; 
}

#strength-title {
  color: rgb(230, 230, 0);
}

#wisdom-title {
  color: rgb(48, 101, 245);
}

#agility-title {
  color: rgb(20, 167, 15);
}

#perception-title {
  color: var(--per);
}

#courage-title {
  color: rgb(245, 42, 42);
}

#endurance-title {
  color: rgb(97, 97, 97);
}

/* --------------------------
   Inputs / selects / textarea
   -------------------------- */
input[type="text"], select, textarea {
  width:100%;
  padding:10px 12px;
  border-radius:8px;
  border:1px solid rgba(255,255,255,0.04);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  outline:none;
}

textarea[readonly] { 
  background: rgba(255,255,255,0.05); 
  color:vvar(--text); 
}

/* --------------------------
   Modals
   -------------------------- */
.modal {
  display: none;
  position: fixed;
  inset:0;
  background: rgba(3,7,18,0.6);
  z-index:1200;
  padding:30px 12px;
}

.modal-content {
  max-width:520px;
  margin:48px auto;
  background: var(--bg);
  border-radius:12px;
  padding:18px;
  border:1px solid rgba(255,255,255,0.03);
  box-shadow: 0 10px 50px rgba(2,6,23,0.7);
  position:relative;
}

.modal-content h2 { 
  color: var(--text); 
  text-align: center; 
  margin-bottom: 10px; 
}

.modal-content label { 
  color: var(--muted); 
  font-weight: 600; 
  display: block; 
  margin-top: 10px;
  margin-bottom: 10px;
}

.modal-content button { 
  margin-top: 12px; 
}

/* close X */
.modal .close {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
}

.modal .close:hover { 
  color: var(--text); 
}

/* modal action buttons */
.modal-content button {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg,var(--accent2),var(--accent1));
  color: white;
  font-weight: 700;
  cursor: pointer;
}
.modal-content button.secondary {
  background:transparent;
  border:1px solid rgba(255,255,255,0.04);
}

footer {
  position: fixed;
  bottom: 3px;
  left: 6px;
  color: #96989c;
}

footer a {
  text-decoration: none;
  color: #96989c;
}

/* --------------------------
   Small screens
   -------------------------- */
@media (max-width:900px) {
  .header-buttons{ flex-wrap:wrap; gap:8px; }
  .character-selector{ flex-direction:column; align-items:flex-start; gap:8px; }
  .stat-box{ flex:1 1 46%; min-width:45%; }
}

@media (max-width:520px) {
  .stat-box{ flex:1 1 100%; min-width:100%; }
  .header-buttons button{ padding:8px 10px; font-size:0.9rem; }
}
