/* Modern dark theme - pure CSS */
:root{
  --bg: #0b1020;
  --card: #0f1724;
  --muted: #9aa4b2;
  --text: #e6eef8;
  --primary: #6c9cff;
  --accent: #7cffc3;
  --danger: #ff6b6b;
  --success: #32d58a;
  --radius: 16px;
  --ring: 1px solid rgba(255,255,255,0.04);
  --shadow: 0 16px 40px rgba(0,0,0,0.45);
}
*{box-sizing:border-box}
body{margin:0;background:linear-gradient(180deg,#071026,#0b1020);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial}
.app{max-width:1100px;margin:32px auto;padding:0 18px}
.shell{background:linear-gradient(180deg,rgba(255,255,255,0.02),rgba(255,255,255,0.01));border:var(--ring);border-radius:20px;box-shadow:var(--shadow);overflow:hidden}
.topbar{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:var(--ring)}
.brand{display:flex;align-items:center;gap:10px;font-weight:800}
.brand .dot{width:12px;height:12px;border-radius:50%;background:linear-gradient(135deg,var(--primary),var(--accent));box-shadow:0 0 20px var(--primary)}
.nav a{color:var(--muted);text-decoration:none;margin-left:12px;padding:8px 10px;border-radius:10px}
.nav a.active,.nav a:hover{color:var(--text);background:rgba(255,255,255,0.03)}
.header{padding:20px 20px 8px}
.header h1{margin:0;font-size:clamp(1.4rem,2.4vw,2rem)}
.header p{margin:6px 0 0;color:var(--muted)}
.section{padding:18px 20px 28px}
.card{background:var(--card);border-radius:14px;border:var(--ring);padding:14px;box-shadow:0 8px 30px rgba(0,0,0,0.45)}
.table{width:100%;border-collapse:collapse;margin-top:8px}
.table th,.table td{padding:12px 10px;border-bottom:1px solid rgba(255,255,255,0.03);text-align:left}
.table th{color:var(--muted);font-weight:600}
.badge{display:inline-block;padding:6px 10px;border-radius:999px;background:rgba(108,156,255,0.12);color:var(--primary);font-weight:700;font-size:.85rem}
.btn{appearance:none;border:none;border-radius:12px;padding:10px 14px;font-weight:700;cursor:pointer;background:linear-gradient(180deg,rgba(108,156,255,0.35),rgba(108,156,255,0.18));color:#eaf3ff}
.btn-danger{background:linear-gradient(180deg,rgba(255,107,107,0.45),rgba(255,107,107,0.22))}
.btn-warning{background:linear-gradient(180deg,rgba(247,179,43,0.45),rgba(247,179,43,0.22))}
.btn-success{background:linear-gradient(180deg,rgba(50,213,138,0.45),rgba(50,213,138,0.22))}
.btn-info{background:linear-gradient(180deg,rgba(74,163,255,0.45),rgba(74,163,255,0.22))}
.btn-ghost{background:transparent;border:1px dashed rgba(255,255,255,0.04);color:var(--muted)}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}

/* Practice Flashcards Layout */
#flashcards-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.flashcard {
    width: 250px;
    height: 200px;
    perspective: 1000px;
    margin:10px;
    cursor: pointer;
    position: relative;
}

.flashcard-inner {
    width: 100%;
    height: 200%;
    text-align:center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    position: relative;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility:hidden; /*Safari fix*/
    backface-visibility: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.3rem;
    padding: 15px;
    background: #fff;
}

.flashcard-front{
    background:#ffffff;
    font-weight:bold;
    color:#333;
}

.flashcard-back {
    transform: rotateY(180deg);
    background: #2d89ef;
    color:#fff;
    font-weight:normal;
}

.buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    width: 300px;
}

/* --- Stats Section --- */

.stats-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin: 15px 0;
  gap: 10px;
}

.stat-card {
  background: var(--card);
  border-radius: 10px;
  padding: 12px 10px; /* smaller padding */
  flex: 1 1 160px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  border: var(--ring);
}

.stat-card h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.stat-card p {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

/* Compact chart wrapper */
#statsChart {
  max-width: 320px;  /* smaller chart */
  margin: 10px auto; /* reduced margin */
}

/* Grid alternative if used */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}
.stat-box {
    background: var(--card);
    padding: 12px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* Latest words section */
.latest-section {
    margin-top: 20px;
    padding: 15px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.latest-section h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
}

.latest-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.latest-list li {
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-size: 15px;
}

.latest-list li:last-child {
    border-bottom: none;
}

/* Responsive adjustments */
@media (max-width:860px){.form-grid{grid-template-columns:1fr}}
input,select{width:100%;padding:12px;border-radius:10px;border:1px solid rgba(255,255,255,0.04);background:rgba(255,255,255,0.02);color:var(--text)}
.flashcard{position:relative;perspective:1000px;margin-bottom:14px}
.fc-inner{position:relative;width:100%;height:170px;transform-style:preserve-3d;transition:transform .6s}
.flashcard.flipped .fc-inner{transform:rotateY(180deg)}
.fc-face{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:18px;border-radius:12px;background:linear-gradient(180deg,rgba(255,255,255,0.02),rgba(255,255,255,0.01));border:var(--ring);backface-visibility:hidden}
.fc-face.back{transform:rotateY(180deg)}
.fc-term{font-size:clamp(1.2rem,2.6vw,1.6rem);font-weight:800}
.fc-meaning{color:var(--muted);font-size:1rem}
.actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:center;margin-top:12px}
.col-6{width:48%}
@media (max-width:860px){.col-6{width:100%}}
.message{color:var(--muted);margin-top:8px}
