/* English Flashcards — folha de estilo principal */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #263238;
  --muted: #6b7a8a;
  --line: #e4eaf1;
  --primary: #4a90d9;
  --primary-dark: #3276bd;
  --primary-soft: #eaf3fc;
  --green: #2ecc71;
  --green-dark: #1f9d57;
  --green-soft: #e8f9f0;
  --orange: #f39c12;
  --orange-soft: #fff5e4;
  --red: #e74c3c;
  --red-soft: #fdecea;
  --blue: #3498db;
  --blue-soft: #eaf5fd;
  --purple: #8e6bd1;
  --purple-soft: #f1ecfb;
  --gold: #d4a017;
  --gold-soft: #fbf4df;
  --teal: #16a085;
  --teal-soft: #e6f7f3;
  --shadow: 0 10px 35px rgba(40, 70, 100, 0.08);
  --shadow-soft: 0 4px 16px rgba(40, 70, 100, 0.06);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar: 250px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1.12; letter-spacing: -0.035em; margin-bottom: 0.4rem; }
h2 { font-size: 1.18rem; line-height: 1.2; margin-bottom: 0.2rem; letter-spacing: -0.015em; }
h3 { font-size: 1rem; }
code { background: #eef3f8; border: 1px solid #e0e8f0; padding: 0.1rem 0.35rem; border-radius: 5px; font-size: 0.86em; }
kbd { background: #eef3f8; border: 1px solid #dce6f0; border-bottom-width: 2px; border-radius: 5px; padding: 0.08rem 0.35rem; font-size: 0.8em; font-family: inherit; }
::selection { background: #cfe6fb; }

/* ---------- Sidebar / shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 1.5rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  z-index: 40;
}
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--text); padding: 0 0.35rem; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), #72b4ef);
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.05em;
  box-shadow: 0 7px 16px rgba(74, 144, 217, 0.3);
}
.brand-word { display: flex; flex-direction: column; font-weight: 800; font-size: 1.02rem; line-height: 1.05; letter-spacing: -0.02em; }
.brand-word span { color: var(--primary); font-size: 0.77rem; letter-spacing: 0.02em; font-weight: 700; }
.brand-inverse { color: #fff; padding: 0; }
.brand-inverse .brand-word span { color: #b9dcff; }

.nav { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 2rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.72rem 0.8rem;
  border-radius: 10px;
  color: #516171;
  font-weight: 600;
  font-size: 0.92rem;
  transition: 0.18s ease;
}
.nav-link:hover { background: var(--surface-soft); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary-dark); }
.nav-icon { width: 1.1rem; text-align: center; font-size: 1rem; color: #8fa2b4; }
.nav-link.active .nav-icon { color: var(--primary); }

.sidebar-note {
  margin-top: auto;
  margin-bottom: 1rem;
  padding: 0.9rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #f2f8ff, #eaf3fc);
  border: 1px solid #dcebfa;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.sidebar-note strong { font-size: 0.87rem; color: #2b6cae; }
.sidebar-note span { font-size: 0.72rem; color: #6f8ba5; }
.sidebar-footer { border-top: 1px solid var(--line); padding-top: 1rem; }
.user-card { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.8rem; padding: 0 0.2rem; }
.user-card-text { display: flex; flex-direction: column; min-width: 0; }
.user-card-text strong { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-text span { font-size: 0.72rem; color: var(--muted); }
.avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dceeff, #c5e2fb);
  color: #2b6cae;
  font-weight: 800;
  font-size: 0.9rem;
}
.avatar-small { width: 32px; height: 32px; font-size: 0.78rem; }
.avatar-large { width: 58px; height: 58px; font-size: 1.3rem; }
.sidebar-overlay { display: none; }

.main-area { margin-left: var(--sidebar); min-height: 100vh; }
.container { max-width: 1320px; margin: 0 auto; padding: 2rem 2.2rem 3rem; }
.mobile-header { display: none; }

/* ---------- Cabeçalhos, botões, avisos ---------- */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.page-head p { margin-bottom: 0; max-width: 640px; }
.head-actions { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; justify-content: flex-end; }
.eyebrow {
  display: inline-block;
  color: var(--primary-dark);
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.center { text-align: center; }
.text-red { color: var(--red); font-weight: 700; }
.text-orange { color: var(--orange); }
.back-link { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.5rem; }
.back-link:hover { color: var(--primary-dark); }
.text-link { color: var(--primary-dark); font-weight: 700; font-size: 0.84rem; white-space: nowrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.68rem 1rem;
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.2;
  transition: 0.18s ease;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 14px rgba(74, 144, 217, 0.24); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-dark { background: #2d3e50; color: #fff; }
.btn-dark:hover { background: #1f2d3d; }
.btn-ghost { background: #fff; border-color: var(--line); color: #425466; }
.btn-ghost:hover { border-color: #cbd8e5; background: var(--surface-soft); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #cf3f31; }
.btn-large { padding: 0.92rem 1.3rem; border-radius: 12px; font-size: 0.98rem; }
.btn-small { padding: 0.45rem 0.7rem; font-size: 0.78rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #53677a;
  font-size: 1.05rem;
}
.icon-btn:hover { background: var(--surface-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-blue { background: var(--blue-soft); color: #2779ad; }
.badge-green { background: var(--green-soft); color: var(--green-dark); }
.badge-red { background: var(--red-soft); color: #c0392b; }
.badge-orange { background: var(--orange-soft); color: #b9770e; }
.badge-purple { background: var(--purple-soft); color: #6e4daf; }
.badge-gray { background: #eef2f6; color: #647586; }
.badge-light { background: #f2f6fa; color: #617587; }
.level-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid #dceaf8;
  border-radius: 999px;
  background: #fff;
  color: #35566f;
  font-size: 0.8rem;
  white-space: nowrap;
}
.level-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }

.notice {
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  margin-bottom: 1.2rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.notice-soft { background: var(--primary-soft); border-color: #d4e8fa; color: #245d8f; }
.notice-warning { background: var(--orange-soft); border-color: #f8dfb2; color: #8d5c05; }
.notice strong { margin-right: 0.2rem; }

.flash-stack { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.flash {
  border-radius: 10px;
  padding: 0.72rem 0.9rem;
  font-size: 0.88rem;
  border: 1px solid transparent;
  animation: slide-in 0.25s ease both;
}
.flash-success { background: var(--green-soft); border-color: #c9efd9; color: #187a46; }
.flash-error { background: var(--red-soft); border-color: #f5ccc7; color: #a93226; }
.flash-warning { background: var(--orange-soft); border-color: #f6dfb5; color: #8c5b06; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Cards e painéis ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow-soft);
}
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.8rem; }
.panel-head h2 { margin-bottom: 0; }
.panel-sub { color: var(--muted); font-size: 0.84rem; margin-bottom: 1rem; max-width: 720px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.9rem; margin-bottom: 1.2rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  box-shadow: var(--shadow-soft);
  min-height: 116px;
  position: relative;
  overflow: hidden;
}
.stat-highlight { border-color: #f2d2a1; background: linear-gradient(145deg, #fffdf8, #fff9ee); }
.stat-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}
.icon-blue { background: var(--blue-soft); color: #2779ad; }
.icon-green { background: var(--green-soft); color: var(--green-dark); }
.icon-orange { background: var(--orange-soft); color: #b9770e; }
.icon-purple { background: var(--purple-soft); color: #6e4daf; }
.icon-teal { background: var(--teal-soft); color: #0e7c68; }
.icon-gold { background: var(--gold-soft); color: #9a7105; }
.icon-red { background: var(--red-soft); color: #bf3c2e; }
.stat-label { font-size: 0.74rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.65rem; line-height: 1.1; letter-spacing: -0.04em; }
.stat-help { font-size: 0.72rem; color: var(--muted); }
.stat-card-link { color: inherit; text-decoration: none; }
.stat-card-link:hover { text-decoration: none; }
.stat-card-link .stat-help { color: var(--primary); font-weight: 700; }

.dashboard-grid { display: grid; grid-template-columns: 1.35fr 0.9fr; gap: 1rem; margin-bottom: 1rem; }
.dashboard-grid.two { grid-template-columns: 1fr 1fr; }

.level-bars { display: flex; flex-direction: column; gap: 0.9rem; }
.level-row { padding: 0.15rem 0; }
.level-row.current { background: linear-gradient(90deg, #f4f9ff, transparent); border-radius: 8px; padding: 0.45rem 0.5rem; margin: -0.3rem -0.5rem; }
.level-row-head { display: grid; grid-template-columns: 36px 1fr auto 48px; gap: 0.6rem; align-items: baseline; font-size: 0.8rem; margin-bottom: 0.3rem; }
.level-code { font-weight: 800; color: var(--primary-dark); }
.level-name { color: var(--muted); font-size: 0.76rem; }
.level-count { color: var(--muted); font-size: 0.74rem; }
.level-row-head strong { text-align: right; font-size: 0.78rem; }
.level-sub { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.2rem 0.75rem; color: var(--muted); font-size: 0.68rem; margin-top: 0.25rem; }
.level-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin-top: 0.7rem; color: var(--muted); font-size: 0.68rem; }
.level-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-swatch { display: inline-block; width: 15px; height: 7px; border-radius: 99px; }
.legend-started { background: #dbeafe; }
.legend-known { background: #64748b; }
.progress-track { height: 7px; border-radius: 99px; background: #eef3f8; overflow: hidden; position: relative; }
.progress-fill { height: 100%; border-radius: inherit; transition: width 0.5s ease; }
.progress-started { position: absolute; top: 0; bottom: 0; left: 0; background: #dbeafe; }
.progress-track > .progress-fill:not(.progress-started) { position: relative; z-index: 1; }
.fill-green { background: linear-gradient(90deg, #52d98e, #2ecc71); }
.fill-blue { background: linear-gradient(90deg, #6db6ee, #3498db); }
.fill-orange { background: linear-gradient(90deg, #f7b84b, #f39c12); }
.fill-purple { background: linear-gradient(90deg, #b198e5, #8e6bd1); }

.next-level-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 0.9rem 1rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.next-level-box > div:first-child { display: flex; flex-direction: column; gap: 0.1rem; }
.next-level-box strong { font-size: 0.87rem; }
.ring {
  --ring: 0%;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) var(--ring), #e6edf5 0);
  position: relative;
  flex: 0 0 auto;
}
.ring::before { content: ""; position: absolute; inset: 6px; background: #fff; border-radius: 50%; }
.ring span { position: relative; z-index: 1; font-size: 0.62rem; font-weight: 800; color: #3b6d9b; }

.today-panel { display: flex; flex-direction: column; }
.today-total { display: flex; align-items: baseline; gap: 0.5rem; margin: 0.3rem 0 0.7rem; }
.today-total strong { font-size: 3rem; line-height: 1; letter-spacing: -0.07em; color: var(--primary-dark); }
.today-total span { color: var(--muted); font-size: 0.8rem; max-width: 130px; }
.today-breakdown { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; font-size: 0.82rem; color: #4b6072; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.35rem; }
.dot-orange { background: var(--orange); }
.dot-green { background: var(--green); }
.next-review-line { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--line); font-size: 0.75rem; color: var(--muted); }
.next-review-line strong { color: var(--text); font-weight: 700; }

.activity-panel .chart { height: 180px; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 150px; margin-top: 0.6rem; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; min-width: 0; height: 100%; }
.chart-bar-wrap { width: 100%; flex: 1; display: flex; align-items: flex-end; background: #f5f8fb; border-radius: 5px 5px 3px 3px; overflow: hidden; }
.chart-bar { width: 100%; min-height: 2px; background: #dbe7f2; border-radius: 4px 4px 0 0; transition: height 0.4s ease; }
.chart-bar.has-value { background: linear-gradient(180deg, #70b7ef, #4a90d9); }
.chart-label { font-size: 0.62rem; color: var(--muted); }
.chart-date { font-size: 0.55rem; color: #9aa9b7; white-space: nowrap; }
.chart-small { height: 130px; gap: 2px; }
.chart-small .chart-bar-wrap { border-radius: 3px; }
.activity-summary { display: flex; justify-content: space-between; gap: 0.5rem; border-top: 1px solid var(--line); padding-top: 0.8rem; margin-top: 0.8rem; }
.activity-summary > div { display: flex; flex-direction: column; gap: 0.1rem; }
.activity-summary strong { font-size: 0.9rem; }

.compact-list { display: flex; flex-direction: column; }
.compact-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.62rem 0; border-bottom: 1px solid #f0f4f8; }
.compact-row:last-child { border-bottom: none; }
.compact-row > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.compact-row strong { font-size: 0.88rem; }
.compact-row span { color: var(--muted); font-size: 0.76rem; }
.compact-meta { display: flex; align-items: center; gap: 0.5rem; flex: 0 0 auto; }
.compact-meta .text-red { font-size: 0.72rem; }
.empty-inline { display: flex; flex-direction: column; gap: 0.2rem; padding: 1rem; border-radius: 10px; background: var(--surface-soft); color: var(--muted); font-size: 0.82rem; margin: 0.5rem 0; }
.empty-inline strong { color: var(--text); font-size: 0.88rem; }

.recent-panel { margin-bottom: 1rem; }
.recent-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}
.recent-filters .field { font-size: 0.72rem; }
.recent-filters .field-inline {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}
.recent-filters .field-inline select { min-width: 160px; }
.recent-filters .recent-filter-count {
  margin-left: auto;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 700;
}
.recent-table-scroll {
  max-height: 640px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.recent-table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
}
.recent-table-scroll tbody tr:last-child td { border-bottom: none; }
.table-recent .recent-empty-row td {
  padding: 1.2rem;
  color: var(--muted);
  text-align: center;
}
html.device-mobile .table-recent thead th:nth-child(2),
html.device-mobile .table-recent thead th:nth-child(3),
html.device-mobile .table-recent thead th:nth-child(6),
html.device-mobile .table-recent tbody td:nth-child(2),
html.device-mobile .table-recent tbody td:nth-child(3),
html.device-mobile .table-recent tbody td:nth-child(6) { display: none; }
html.device-mobile .recent-filters {
  flex-direction: column;
  align-items: stretch;
}
html.device-mobile .recent-filters .field-inline select {
  width: 100%;
  min-width: 0;
}
html.device-mobile .recent-filters .btn { width: 100%; }
html.device-mobile .recent-filters .recent-filter-count {
  margin-left: 0;
  text-align: center;
}
html.device-mobile .recent-table-scroll {
  max-height: min(640px, 88vh);
}
html.device-mobile .table-recent th,
html.device-mobile .table-recent td {
  padding: 0.36rem 0.4rem;
}
html.device-mobile .table-recent .table-sub { font-size: 0.64rem; }
.table-wrap { overflow-x: auto; margin: 0 -0.15rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.table th { text-align: left; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: #8394a5; font-weight: 800; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 0.65rem 0.6rem; border-bottom: 1px solid #f0f4f8; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fbfdff; }
.table-sub { display: block; color: var(--muted); font-size: 0.7rem; margin-top: 0.08rem; }
.table-users td { padding-top: 0.72rem; padding-bottom: 0.72rem; }
.table-actions { text-align: right; }
.user-cell { display: flex; align-items: center; gap: 0.55rem; }
.user-cell > div { display: flex; flex-direction: column; }

.rating-pill { display: inline-flex; border-radius: 999px; padding: 0.22rem 0.5rem; font-size: 0.67rem; font-weight: 800; }
.rating-0 { background: var(--red-soft); color: #c0392b; }
.rating-1 { background: var(--orange-soft); color: #a96905; }
.rating-2 { background: var(--green-soft); color: #187a46; }
.rating-3 { background: var(--blue-soft); color: #2779ad; }

.admin-shortcut {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: #2d3e50; color: #fff; padding: 1.1rem 1.3rem; border-radius: var(--radius);
  margin-top: 1rem;
}
.admin-shortcut .eyebrow { color: #a8cff2; margin-bottom: 0.15rem; }
.admin-shortcut strong { font-size: 0.88rem; font-weight: 600; color: #f2f7fb; }
.admin-shortcut .btn { flex: 0 0 auto; }
.admin-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
html.device-mobile .admin-overview-stats .stat-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.admin-user-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.danger-zone { border-color: #f4d2ce; background: linear-gradient(135deg, #fffdfd, #fff8f7); }
.danger-zone .btn-danger { margin-top: 0.2rem; }

/* ---------- Formulários ---------- */
.form-stack { display: flex; flex-direction: column; gap: 0.8rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.form-row-end { align-items: end; }
.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; color: #40576b; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid #d8e2ec;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  padding: 0.66rem 0.75rem;
  font-weight: 500;
  outline: none;
  transition: 0.18s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.13);
}
.field small { color: var(--muted); font-weight: 500; font-size: 0.7rem; }
.field-inline { flex-direction: row; align-items: center; gap: 0.6rem; }
.field-inline input { width: 88px; }
.field-compact { max-width: 130px; }
.inline-form { display: flex; align-items: flex-end; gap: 0.7rem; flex-wrap: wrap; }
.check-field { display: flex; align-items: flex-start; gap: 0.45rem; font-size: 0.8rem; color: #40576b; font-weight: 600; padding-bottom: 0.55rem; }
.check-field input { width: auto; margin-top: 0.15rem; }
.password-wrap { position: relative; display: flex; }
.password-wrap input { padding-right: 3.3rem; }
.password-toggle { position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--primary-dark); font-size: 0.7rem; font-weight: 800; padding: 0.35rem; }
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  border: 1.5px dashed #bfd4e7;
  background: #f8fbfe;
  border-radius: 12px;
  padding: 1.15rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  transition: 0.18s ease;
}
.dropzone:hover { border-color: var(--primary); background: #f2f9ff; }
.dropzone-icon { font-size: 1.4rem; color: var(--primary); }
.dropzone strong { color: var(--text); font-size: 0.85rem; }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.import-note { display: flex; flex-direction: column; gap: 0.15rem; margin-top: 1rem; padding: 0.8rem 0.9rem; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; font-size: 0.75rem; color: var(--muted); }
.import-note strong { color: var(--text); font-size: 0.8rem; }

/* ---------- Perfil ---------- */
.profile-grid { display: grid; grid-template-columns: 300px 1fr; gap: 1rem; align-items: start; }
.profile-card { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; }
.profile-avatar { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: linear-gradient(135deg, #dceeff, #c5e2fb); color: #2b6cae; font-size: 1.5rem; font-weight: 800; }
.profile-card h2 { margin-bottom: 0; }
.detail-list { width: 100%; margin: 0.7rem 0 0; display: flex; flex-direction: column; }
.detail-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.52rem 0; border-bottom: 1px solid #f0f4f8; font-size: 0.78rem; }
.detail-list > div:last-child { border-bottom: none; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 700; text-align: right; }
.profile-forms { display: flex; flex-direction: column; gap: 1rem; }

/* ---------- Login ---------- */
.login-body { background: #eef4fa; }
.auth-shell { min-height: 100vh; }
.login-layout { display: grid; grid-template-columns: 1.1fr 0.9fr; min-height: 100vh; }
.login-hero {
  background:
    radial-gradient(circle at 20% 15%, rgba(128, 196, 255, 0.36), transparent 30%),
    radial-gradient(circle at 85% 80%, rgba(74, 144, 217, 0.35), transparent 35%),
    linear-gradient(145deg, #1e4e7c, #2e6ca6 50%, #3b82c4);
  color: #fff;
  padding: 2.2rem 3.2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-hero::after {
  content: "";
  position: absolute;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.13);
  right: -160px;
  bottom: -180px;
  box-shadow: 0 0 0 70px rgba(255, 255, 255, 0.03), 0 0 0 140px rgba(255, 255, 255, 0.025);
}
.login-hero-copy { max-width: 560px; position: relative; z-index: 1; }
.login-hero .eyebrow { color: #b9dcff; }
.login-hero h1 { font-size: clamp(2.6rem, 5.2vw, 4.8rem); line-height: 0.98; letter-spacing: -0.055em; margin: 0.7rem 0 1rem; }
.login-hero p { color: #d7e9fa; font-size: 1rem; max-width: 490px; }
.hero-list { list-style: none; padding: 0; margin: 1.8rem 0 0; display: flex; flex-direction: column; gap: 0.65rem; }
.hero-list li { display: flex; align-items: center; gap: 0.6rem; color: #e8f4ff; font-size: 0.88rem; }
.hero-list li span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 0.65rem; }
.login-hero-foot { color: #a9cdec; font-size: 0.78rem; position: relative; z-index: 1; }
.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; background: #f7fafc; position: relative; }
.login-card { width: min(430px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 2.1rem; box-shadow: var(--shadow); }
.login-card h2 { font-size: 1.65rem; margin-bottom: 0.25rem; letter-spacing: -0.04em; }
.login-card > p { font-size: 0.86rem; margin-bottom: 1.4rem; }
.login-help { margin: 1.2rem 0 0; text-align: center; font-size: 0.76rem; color: var(--muted); }
.login-copyright { position: absolute; bottom: 1.4rem; font-size: 0.68rem; color: #8ba0b2; }
.auth-flashes { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 50; width: min(460px, calc(100% - 2rem)); }

/* ---------- Estudo ---------- */
.study-body { background: #f4f8fc; }
.study-page { max-width: 880px; margin: 0 auto; }
.study-topline { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.6rem; }
.study-topline .eyebrow { margin-bottom: 0; }
.study-progress-track { height: 5px; background: #e3ecf5; border-radius: 99px; overflow: hidden; margin-bottom: 1rem; }
.study-progress-fill { height: 100%; background: linear-gradient(90deg, #70b7ef, #4a90d9); border-radius: inherit; transition: width 0.35s ease; }
.study-shell { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 1.4rem; box-shadow: var(--shadow); }
.study-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.mode-badge { display: inline-flex; border-radius: 999px; padding: 0.32rem 0.6rem; font-size: 0.68rem; font-weight: 800; background: var(--primary-soft); color: var(--primary-dark); }
.state-badge { display: inline-flex; border-radius: 999px; padding: 0.32rem 0.6rem; font-size: 0.68rem; font-weight: 800; background: #f2f6fa; color: #617587; }
.audio-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 0.3rem; border: 1px solid #d9e8f6; background: #f6fbff; color: #2b6cae; border-radius: 999px; padding: 0.38rem 0.7rem; font-size: 0.72rem; font-weight: 800; }
.audio-btn:hover { background: #eaf4fe; }
.flashcard {
  min-height: 330px;
  border: 1px solid #e2ebf4;
  border-radius: 18px;
  background:
    radial-gradient(circle at 90% 8%, rgba(74, 144, 217, 0.08), transparent 26%),
    linear-gradient(160deg, #ffffff, #fbfdff);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: inset 0 1px 0 #fff, 0 10px 30px rgba(40, 70, 100, 0.05);
}
.card-prompt { font-size: 0.7rem; letter-spacing: 0.09em; text-transform: uppercase; color: #8ba0b2; font-weight: 800; }
.card-word { font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.05; letter-spacing: -0.055em; font-weight: 800; margin: 0.7rem 0 0.4rem; overflow-wrap: anywhere; }
.card-word.sentence { font-size: clamp(1.2rem, 3.2vw, 1.85rem); line-height: 1.45; letter-spacing: -0.02em; font-weight: 600; max-width: 620px; }
.card-context { color: var(--muted); font-size: 0.85rem; margin: 0; max-width: 560px; }
.card-answer { font-size: clamp(1.5rem, 4vw, 2.4rem); font-weight: 800; line-height: 1.15; letter-spacing: -0.035em; margin: 0.55rem 0 0.6rem; overflow-wrap: anywhere; }
.card-details { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; color: #53677a; font-size: 0.86rem; max-width: 620px; }
.card-details .pronunciation { color: var(--primary-dark); font-weight: 700; }
.card-details .example { margin-top: 0.4rem; padding-top: 0.6rem; border-top: 1px solid #eaf0f6; color: #425466; font-style: italic; }
.card-details .example-translation { font-size: 0.78rem; color: var(--muted); }
.study-actions { margin-top: 1rem; }
.rating-actions { animation: rise 0.22s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.rating-title { text-align: center; color: var(--muted); font-size: 0.78rem; margin: 0 0 0.55rem; }
.rating-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.55rem; }
.rating-btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  color: #fff;
  transition: 0.18s ease;
}
.rating-btn:hover { transform: translateY(-2px); filter: brightness(1.03); }
.rating-btn strong { font-size: 0.86rem; }
.rating-btn span { font-size: 0.66rem; opacity: 0.85; }
.rating-btn.rating-0 { background: linear-gradient(160deg, #ef6355, #e74c3c); box-shadow: 0 5px 13px rgba(231, 76, 60, 0.2); }
.rating-btn.rating-1 { background: linear-gradient(160deg, #f5ad35, #f39c12); box-shadow: 0 5px 13px rgba(243, 156, 18, 0.2); }
.rating-btn.rating-2 { background: linear-gradient(160deg, #48d789, #2ecc71); box-shadow: 0 5px 13px rgba(46, 204, 113, 0.2); }
.rating-btn.rating-3 { background: linear-gradient(160deg, #58b4ee, #3498db); box-shadow: 0 5px 13px rgba(52, 152, 219, 0.2); }
.rating-btn:disabled { opacity: 0.6; transform: none; }
.keyboard-hint { text-align: center; color: #9aabb9; font-size: 0.68rem; margin: 1rem 0 0; }
.keyboard-hint kbd { margin: 0 0.1rem; }
.study-finish, .empty-state {
  background: #fff; border: 1px solid var(--line); border-radius: 22px;
  padding: 3rem 1.5rem; text-align: center; box-shadow: var(--shadow);
}
.study-finish h1, .empty-state h1 { margin-bottom: 0.4rem; }
.finish-icon, .empty-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); font-size: 1.8rem; font-weight: 800; }
.empty-icon { background: var(--primary-soft); color: var(--primary-dark); }
.finish-stats { display: flex; justify-content: center; gap: 1.4rem; flex-wrap: wrap; margin: 1.4rem 0; }
.finish-stat { display: flex; flex-direction: column; gap: 0.1rem; min-width: 90px; }
.finish-stat strong { font-size: 1.5rem; letter-spacing: -0.04em; }
.finish-stat span { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.finish-actions { display: flex; justify-content: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.3rem; }
.study-empty .muted { max-width: 540px; margin-left: auto; margin-right: auto; }
.study-empty p { margin-bottom: 0.5rem; }
.error-state { margin-top: 8vh; }
.error-code { font-size: 4rem; font-weight: 800; letter-spacing: -0.08em; color: var(--primary); line-height: 1; }
.user-title { display: flex; align-items: center; gap: 0.8rem; }

/* ---------- Responsivo ---------- */
@media (max-width: 1120px) {
  .stats-grid, .admin-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-user-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  :root { --sidebar: 240px; }
  .container { padding: 1.5rem 1.2rem 2.5rem; }
  .login-layout { grid-template-columns: 1fr; }
  .login-hero { min-height: 380px; padding: 2rem; }
  .login-hero h1 { font-size: clamp(2.5rem, 8vw, 3.8rem); }
  .login-hero-foot { display: none; }
  .login-panel { padding: 2rem 1.2rem 4rem; }
  .login-copyright { bottom: 1rem; }
  .dashboard-grid, .dashboard-grid.two, .admin-grid, .profile-grid { grid-template-columns: 1fr; }
  .profile-card { display: grid; grid-template-columns: auto 1fr; column-gap: 1rem; }
  .profile-card .profile-avatar { grid-row: span 3; }
  .profile-card .detail-list, .profile-card .btn { grid-column: 1 / -1; }
  .admin-shortcut { flex-direction: column; align-items: flex-start; }
  .admin-shortcut .btn { width: 100%; }
}

@media (max-width: 720px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    box-shadow: 10px 0 30px rgba(20, 40, 60, 0.12);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(18, 33, 48, 0.35); z-index: 35; }
  .main-area { margin-left: 0; }
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    background: rgba(255, 255, 255, 0.93);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(10px);
  }
  .brand-mobile .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 0.8rem; }
  .container { padding: 1.2rem 0.9rem 2rem; }
  .page-head { flex-direction: column; gap: 0.8rem; }
  .head-actions { justify-content: flex-start; }
  .stats-grid, .admin-stats, .admin-user-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { min-height: 106px; padding: 0.85rem; }
  .stat-value { font-size: 1.4rem; }
  .panel { padding: 1rem; border-radius: 14px; }
  .flashcard { min-height: 290px; padding: 1.2rem; }
  .card-word { font-size: clamp(1.9rem, 9vw, 3rem); }
  .rating-grid { grid-template-columns: 1fr 1fr; }
  .rating-btn { padding: 0.65rem 0.4rem; }
  .study-shell { padding: 0.9rem; border-radius: 16px; }
  .study-finish, .empty-state { padding: 2rem 1rem; border-radius: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .field-inline { flex-direction: column; align-items: flex-start; }
  .field-inline input { width: 100%; }
  .inline-form { align-items: stretch; }
  .inline-form .btn { width: 100%; }
  .login-card { padding: 1.5rem; border-radius: 18px; }
  .login-hero { min-height: 320px; }
  .hero-list { margin-top: 1rem; gap: 0.45rem; }
  .hero-list li { font-size: 0.8rem; }
  .table th, .table td { padding: 0.55rem 0.45rem; }
  .level-row-head { grid-template-columns: 32px 1fr 42px; }
  .level-row-head .level-count { display: none; }
  .next-review-line { flex-direction: column; gap: 0.2rem; }
  .activity-summary { gap: 0.3rem; }
  .activity-summary strong { font-size: 0.8rem; }
  .admin-user-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .stats-grid, .admin-stats { grid-template-columns: 1fr; }
  .stat-card { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 0.7rem; min-height: 0; }
  .stat-icon { margin-bottom: 0; }
  .stat-label { flex: 1; }
  .stat-value { width: 100%; font-size: 1.5rem; }
  .stat-help { width: 100%; margin-left: 2.7rem; }
  .chart-date { display: none; }
  .chart-label { font-size: 0.55rem; }
  .rating-grid { gap: 0.4rem; }
  .rating-btn strong { font-size: 0.78rem; }
  .login-hero { padding: 1.5rem; }
  .login-hero h1 { font-size: 2.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ==================================================================
   TEMA BRANCO + VERMELHO · CARDS FLUTUANTES COM VIRADA 3D
   ================================================================== */
:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --text: #18181b;
  --muted: #71717a;
  --line: #e8e8eb;
  --primary: #e11d2e;
  --primary-dark: #b31220;
  --primary-soft: #fff1f2;
  --green: #18181b;
  --green-dark: #18181b;
  --green-soft: #f4f4f5;
  --orange: #b45309;
  --orange-soft: #fff7ed;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --blue: #e11d2e;
  --blue-soft: #fff1f2;
  --purple: #7f1d1d;
  --purple-soft: #fff1f2;
  --gold: #9a3412;
  --gold-soft: #fff7ed;
  --teal: #18181b;
  --teal-soft: #f4f4f5;
  --shadow: 0 28px 70px -28px rgba(24, 24, 27, 0.28), 0 10px 26px rgba(24, 24, 27, 0.06);
  --shadow-soft: 0 8px 24px rgba(24, 24, 27, 0.05);
}

[hidden] { display: none !important; }
body { background: var(--bg); color: var(--text); }
::selection { background: #fecdd3; color: #7f1d1d; }

/* Marca e navegação */
.brand-mark {
  background: linear-gradient(145deg, #ef4444, #b31220 65%, #7f1d1d);
  box-shadow: 0 8px 20px rgba(225, 29, 46, 0.28);
}
.brand-word span { color: var(--primary); }
.brand-inverse .brand-word span { color: #fecdd3; }
.nav-link.active { background: var(--primary-soft); color: var(--primary-dark); }
.nav-link.active .nav-icon { color: var(--primary); }
.sidebar-note {
  background: linear-gradient(135deg, #fff, #fff1f2);
  border-color: #fecdd3;
}
.sidebar-note strong { color: #9f1239; }
.sidebar-note span { color: #a46b75; }
.avatar {
  background: linear-gradient(135deg, #fff1f2, #fecdd3);
  color: #9f1239;
}
.level-dot { background: var(--primary); box-shadow: 0 0 0 4px #ffe4e6; }
.level-pill { border-color: #fecdd3; background: #fff; color: #7f1d1d; }

/* Botões */
.btn-primary {
  background: linear-gradient(145deg, #ef4444, #e11d2e 55%, #b31220);
  box-shadow: 0 8px 18px rgba(225, 29, 46, 0.24);
}
.btn-primary:hover { background: linear-gradient(145deg, #dc2626, #b31220); }
.btn-dark { background: #18181b; }
.btn-dark:hover { background: #3f3f46; }
.btn-ghost:hover { border-color: #fecdd3; background: #fff1f2; color: #9f1239; }
.btn-danger { background: #b91c1c; }
.btn-danger:hover { background: #991b1b; }

/* Avisos e mensagens */
.flash-success { background: #f4f4f5; border-color: #e4e4e7; color: #18181b; }
.flash-error { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.flash-warning { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.notice-soft { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.notice-warning { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }

/* Badges */
.badge-blue, .badge-purple { background: var(--primary-soft); color: var(--primary-dark); }
.badge-green { background: #f4f4f5; color: #18181b; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-orange { background: #fff7ed; color: #9a3412; }
.badge-gray { background: #f4f4f5; color: #52525b; }
.badge-light { background: #fafafa; color: #52525b; border: 1px solid #ececef; }

/* Cards, sombras e microinterações */
.panel, .stat-card {
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.panel:hover, .stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 48px -24px rgba(24, 24, 27, 0.22), 0 8px 18px rgba(24, 24, 27, 0.05);
  border-color: #dedee2;
}
/* Cards visíveis imediatamente; apenas o hover anima. */
.stat-highlight {
  background: linear-gradient(145deg, #fff, #fff5f5);
  border-color: #fecdd3;
}
.stat-icon { border: 1px solid #f4f4f5; }
.icon-blue, .icon-green, .icon-teal, .icon-gold {
  background: #fff1f2;
  color: #b31220;
}
.icon-orange { background: #fff7ed; color: #9a3412; }
.icon-purple { background: #f4f4f5; color: #18181b; }
.icon-red { background: #fee2e2; color: #991b1b; }
.stat-value { color: #18181b; }
.today-total strong { color: var(--primary); }
.next-level-box { background: #fafafa; }
.level-row.current {
  background: linear-gradient(90deg, #fff1f2, transparent);
}
.level-code { color: var(--primary-dark); }
.fill-green, .fill-blue, .fill-orange, .fill-purple {
  background: linear-gradient(90deg, #f87171, #e11d2e 60%, #991b1b);
}
.ring { background: conic-gradient(var(--primary) var(--ring), #f4f4f5 0); }
.ring span { color: #9f1239; }
.chart-bar.has-value { background: linear-gradient(180deg, #f87171, #e11d2e 70%, #b31220); }
.chart-bar-wrap { background: #f7f7f8; }
.admin-shortcut {
  background:
    radial-gradient(circle at 90% 0%, rgba(225, 29, 46, 0.25), transparent 45%),
    #18181b;
  border: 1px solid #27272a;
}
.admin-shortcut .eyebrow { color: #fca5a5; }
.admin-shortcut strong { color: #fafafa; }
.admin-shortcut .btn-dark { background: #e11d2e; }
.admin-shortcut .btn-dark:hover { background: #b31220; }
.table tbody tr:hover { background: #fff7f7; }

/* Login */
.login-body { background: #f7f7f8; }
.login-hero {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.22), transparent 28%),
    radial-gradient(circle at 88% 84%, rgba(127, 29, 29, 0.55), transparent 38%),
    linear-gradient(145deg, #7f1d1d, #b91c1c 52%, #e11d2e);
}
.login-hero .eyebrow { color: #fecdd3; }
.login-hero p { color: #ffe4e6; }
.hero-list li { color: #fff1f2; }
.hero-list li span { background: rgba(255, 255, 255, 0.18); }
.login-hero-foot { color: #fca5a5; }
.login-card { border-color: #ececef; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(225, 29, 46, 0.12);
}
.password-toggle { color: var(--primary-dark); }
.dropzone { border-color: #fecdd3; background: #fffafa; }
.dropzone:hover { border-color: var(--primary); background: #fff1f2; }
.dropzone-icon { color: var(--primary); }
.profile-avatar { background: linear-gradient(135deg, #fff1f2, #fecdd3); color: #9f1239; }
.import-note { background: #fafafa; }
.danger-zone { border-color: #fecdd3; background: linear-gradient(135deg, #fff, #fff7f7); }

/* Nível e histórico */
.level-sub { color: #a1a1aa; }
.text-red { color: #b91c1c; }
.rating-pill.rating-0 { background: #fee2e2; color: #991b1b; }
.rating-pill.rating-1 { background: #fecdd3; color: #9f1239; }
.rating-pill.rating-2 { background: #f4f4f5; color: #18181b; }
.rating-pill.rating-3 { background: #fff1f2; color: #b31220; border: 1px solid #fecdd3; }

/* ===== Flashcard flutuante com virada 3D ===== */
.study-shell {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0.2rem 0;
}
.study-meta { padding: 0 0.2rem; }
.mode-badge { background: #fff1f2; color: #b31220; border: 1px solid #fecdd3; }
.state-badge { background: #fafafa; color: #52525b; border: 1px solid #ececef; }
.audio-btn {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #b31220;
}
.audio-btn:hover { background: #ffe4e6; }
.flashcard {
  position: relative;
  isolation: isolate;
  min-height: 440px;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  box-shadow: none;
  perspective: 1600px;
  animation: card-float 5.5s ease-in-out infinite;
  transition: opacity 0.18s ease;
  cursor: pointer;
}
.flashcard::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 12% 7% -9%;
  border-radius: 30px;
  background: radial-gradient(ellipse at center, rgba(225, 29, 46, 0.28), transparent 68%);
  filter: blur(34px);
  opacity: 0.9;
}
.flashcard::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 8%;
  right: 8%;
  bottom: -10px;
  height: 26px;
  border-radius: 50%;
  background: rgba(24, 24, 27, 0.16);
  filter: blur(18px);
}
.flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 440px;
  transform-style: preserve-3d;
  transition: transform 0.72s cubic-bezier(0.2, 0.78, 0.2, 1);
  will-change: transform;
}
.flashcard.is-flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  inset: 0;
  min-height: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 2.2rem;
  border: 1px solid #ececef;
  border-radius: 24px;
  background:
    radial-gradient(circle at 86% 8%, rgba(225, 29, 46, 0.055), transparent 30%),
    linear-gradient(160deg, #ffffff, #fdfdfd);
  box-shadow:
    0 34px 80px -34px rgba(24, 24, 27, 0.38),
    0 16px 34px rgba(24, 24, 27, 0.07),
    inset 0 1px 0 #ffffff;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: box-shadow 0.25s ease;
}
.flashcard:hover .flashcard-face {
  box-shadow:
    0 40px 90px -34px rgba(24, 24, 27, 0.44),
    0 18px 40px rgba(24, 24, 27, 0.08),
    inset 0 1px 0 #ffffff;
}
.flashcard-front::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  width: 34px;
  height: 3px;
  border-radius: 99px;
  background: #fecdd3;
  transform: translateX(-50%);
}
.flashcard-back {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 10% 90%, rgba(225, 29, 46, 0.06), transparent 32%),
    linear-gradient(160deg, #ffffff, #fffafa);
}
.flashcard-back::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(90deg, #7f1d1d, #e11d2e 55%, #fca5a5);
}
.flip-hint {
  text-align: center;
  color: #a1a1aa;
  font-size: 0.7rem;
  margin: 0.8rem 0 0;
}
.card-prompt { color: #a1a1aa; }
.card-word { color: #18181b; }
.card-context { color: #71717a; }
.card-answer { color: #18181b; }
.card-details { color: #52525b; }
.card-details .pronunciation { color: #b31220; }
.card-details .example { border-top-color: #f4f4f5; color: #3f3f46; }
.card-details .example-translation { color: #a1a1aa; }

/* Botões de avaliação em branco/vermelho, com acento funcional */
.rating-title { color: #a1a1aa; }
.rating-btn {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid #ececef;
  color: #18181b;
  box-shadow: 0 6px 18px rgba(24, 24, 27, 0.05);
}
.rating-btn::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--rating-color, #e11d2e);
}
.rating-btn.rating-0,
.rating-btn.rating-1,
.rating-btn.rating-2,
.rating-btn.rating-3 {
  background: #fff;
  border: 1px solid #ececef;
  color: #18181b;
  box-shadow: 0 6px 18px rgba(24, 24, 27, 0.05);
}
.rating-btn.rating-0 { --rating-color: #7f1d1d; }
.rating-btn.rating-1 { --rating-color: #dc2626; }
.rating-btn.rating-2 { --rating-color: #18181b; }
.rating-btn.rating-3 { --rating-color: #f87171; }
.rating-btn strong { color: #18181b; }
.rating-btn span { color: #71717a; }
.rating-btn:hover {
  background: #fff1f2;
  border-color: #fecdd3;
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(225, 29, 46, 0.12);
}
.rating-btn:disabled { opacity: 0.55; }
.study-finish, .empty-state { border-color: #ececef; }
.finish-icon { background: #fff1f2; color: #b31220; }
.empty-icon { background: #fff1f2; color: #b31220; }
.study-progress-fill { background: linear-gradient(90deg, #fca5a5, #e11d2e 55%, #b31220); }
.study-progress-track { background: #f4f4f5; }
.keyboard-hint { color: #a1a1aa; }

/* Animação de flutuação */
@keyframes card-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

/* Ajustes responsivos do flashcard */
@media (max-width: 720px) {
  .flashcard, .flashcard-inner, .flashcard-face { min-height: 370px; }
  .flashcard-face { padding: 1.25rem; border-radius: 18px; }
  .flashcard::before { inset: 10% 5% -7%; filter: blur(26px); }
  .study-shell { padding: 0; }
  .card-word { font-size: clamp(1.9rem, 9vw, 3rem); }
  .card-word.sentence { font-size: clamp(1.05rem, 4.5vw, 1.45rem); }
  .flip-hint { font-size: 0.65rem; }
}
@media (max-width: 420px) {
  .flashcard, .flashcard-inner, .flashcard-face { min-height: 330px; }
  .rating-btn { padding: 0.62rem 0.35rem; }
  .rating-btn strong { font-size: 0.78rem; }
  .rating-btn span { font-size: 0.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .flashcard { animation: none; }
  .flashcard-inner { transition: none; }
  .panel:hover, .stat-card:hover, .rating-btn:hover { transform: none; }
}


/* ==================================================================
   ADMINISTRACAO - USUARIOS, GERENCIAMENTO E SESSAO DE ESTUDO
   ================================================================== */

/* Submenu lateral */
.nav-group { display: flex; flex-direction: column; gap: 0.12rem; }
.nav-parent { padding-right: 0.65rem; }
.nav-caret {
  margin-left: auto;
  color: #a1a1aa;
  font-size: 0.8rem;
  line-height: 1;
  transition: transform 0.18s ease;
}
.nav-group.is-open .nav-caret { transform: rotate(180deg); }
.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0.1rem 0 0.35rem 1.45rem;
  padding-left: 0.7rem;
  border-left: 1px solid #f1f1f3;
}
.nav-sublink {
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  color: #71717a;
  font-size: 0.82rem;
  font-weight: 600;
  transition: 0.18s ease;
}
.nav-sublink:hover { background: #fafafa; color: #18181b; }
.nav-sublink.active { background: #fff1f2; color: #b31220; font-weight: 800; }

/* Visao geral */
.admin-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 1rem;
  background:
    radial-gradient(circle at 92% 8%, rgba(225, 29, 46, 0.07), transparent 38%),
    linear-gradient(135deg, #fff, #fffafa);
  border-color: #f4d7da;
}
.admin-callout h2 { margin-bottom: 0.2rem; }
.admin-callout .panel-sub { margin-bottom: 0; }
.admin-callout .btn { flex: 0 0 auto; }

/* Cadastro e lista de usuarios */
.admin-user-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.create-user-panel { margin-bottom: 1rem; }
.user-create-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  align-items: end;
}
.create-user-note {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.1rem 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}
.create-user-note strong { color: var(--text); }
.create-user-submit { grid-column: 1 / -1; width: 100%; }
.table-manage { min-width: 880px; }
.row-actions { display: flex; gap: 0.4rem; justify-content: flex-end; flex-wrap: wrap; }
.manage-row > td {
  padding: 0;
  border-bottom: 1px solid #ececef;
  background: #fafafa;
}
.table tbody tr.manage-row:hover > td { background: #fafafa; }
.manage-panel {
  padding: 1rem 1.1rem 1.2rem;
  border-top: 1px solid #f1f1f3;
  animation: rise 0.2s ease both;
}
.manage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.9rem;
}
.manage-head .eyebrow { margin-bottom: 0.1rem; }
.manage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.manage-block-wide { grid-column: 1 / -1; }
.manage-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.95rem;
}
.manage-block h3 {
  margin: 0 0 0.65rem;
  color: #71717a;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.manage-subtitle { margin-top: 1.1rem !important; }
.manage-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.manage-actions form { margin: 0; }
.manage-block .inline-form { align-items: flex-end; }
.manage-block .field-inline { flex-direction: column; align-items: flex-start; }
.manage-block .field-inline input { width: 100%; }
.manage-block .field-inline select { width: auto; min-width: 190px; }

/* Sessao de estudo: inicio e encerramento */
.study-session-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}
#end-btn { border-color: #fecdd3; color: #9f1239; }
#end-btn:hover { background: #fff1f2; border-color: #fca5a5; }
.study-start {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 3rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  animation: rise 0.25s ease both;
}
.study-start h1 { margin-bottom: 0.45rem; }
.study-start > .muted { max-width: 600px; margin-left: auto; margin-right: auto; }
.study-start > .muted.small { max-width: 500px; margin-top: 1rem; margin-bottom: 0; }
.start-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #b31220;
  font-size: 1.35rem;
  box-shadow: 0 10px 24px rgba(225, 29, 46, 0.12);
}
.start-stats {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin: 1.4rem 0;
}
.start-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 120px;
  padding: 0.75rem 1rem;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.start-stat strong { font-size: 1.45rem; line-height: 1.1; letter-spacing: -0.04em; }
.start-stat span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.study-start .btn { min-width: 230px; }
.study-finish .finish-icon { font-size: 1.5rem; }

@media (max-width: 1120px) {
  .user-create-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .manage-grid { grid-template-columns: 1fr; }
  .admin-callout { flex-direction: column; align-items: flex-start; }
  .admin-callout .btn { width: 100%; }
}

@media (max-width: 720px) {
  .admin-user-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .study-topline { flex-direction: column; gap: 0.5rem; }
  .study-session-actions { width: 100%; justify-content: space-between; }
  .study-start { padding: 2.1rem 1rem; border-radius: 16px; }
  .study-start .btn { width: 100%; min-width: 0; }
  .start-stat { min-width: 0; flex: 1; }
  .user-create-grid { grid-template-columns: 1fr; }
  .create-user-submit { grid-column: 1 / -1; }
  .manage-block .field-inline select { width: 100%; }
  .manage-head { flex-direction: column; gap: 0.2rem; }
  .manage-panel { padding: 0.9rem; }
  .create-user-panel .panel-head,
  #lista-usuarios .panel-head { flex-direction: column; align-items: flex-start; gap: 0.45rem; }
  .create-user-panel .panel-head .badge,
  #lista-usuarios .panel-head .badge { white-space: normal; }
  /* No celular, a lista prioriza identidade, status e acoes; o restante fica no detalhe. */
  .table-manage { min-width: 0; }
  .table-manage thead th:nth-child(3),
  .table-manage thead th:nth-child(4),
  .table-manage thead th:nth-child(5),
  .table-manage thead th:nth-child(6),
  .table-manage thead th:nth-child(7),
  .table-manage tbody tr.user-row > td:nth-child(3),
  .table-manage tbody tr.user-row > td:nth-child(4),
  .table-manage tbody tr.user-row > td:nth-child(5),
  .table-manage tbody tr.user-row > td:nth-child(6),
  .table-manage tbody tr.user-row > td:nth-child(7) { display: none; }
  .table-manage .row-actions { flex-direction: column; align-items: stretch; }
  .table-manage .row-actions .btn { width: 100%; }
  .row-actions { justify-content: flex-end; }
}

@media (max-width: 420px) {
  .admin-user-overview { grid-template-columns: 1fr; }
}

/* ==================================================================
   TEMPORIZADOR DE SESSAO
   ================================================================== */
.main-area .container { padding-top: 4rem; }

.session-timer {
  position: fixed;
  top: 0.9rem;
  right: 1.2rem;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.78rem;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.14);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.session-timer::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.session-timer-label { color: #1e40af; letter-spacing: 0.02em; }
.session-timer-value {
  font-variant-numeric: tabular-nums;
  font-size: 0.84rem;
  letter-spacing: 0.03em;
}
.session-timer.is-warning { opacity: 0; pointer-events: none; transform: translateY(-4px); }

.session-warning {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(2px);
}
.session-warning-card {
  width: min(440px, 100%);
  padding: 2rem;
  border: 1px solid #fecdd3;
  border-radius: 22px;
  background: #fff;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.32);
}
.session-warning-card h2 { margin-bottom: 0.4rem; }
.session-warning-card .muted.small { max-width: 330px; margin: 0.9rem auto 1.2rem; }
.session-warning-countdown {
  margin: 0.5rem 0 0;
  color: #dc2626;
  font-size: clamp(2.8rem, 9vw, 4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
  animation: session-blink 1s steps(2, start) infinite;
}
@keyframes session-blink {
  50% { opacity: 0.4; }
}

@media (max-width: 720px) {
  .main-area .container { padding-top: 1.2rem; }
  .session-timer { top: 0.55rem; right: 4.4rem; }
  .session-warning-card { padding: 1.5rem 1.1rem; }
}

@media (max-width: 480px) {
  .session-timer-label { display: none; }
  .session-timer { right: 4.2rem; padding: 0.4rem 0.62rem; }
}

/* ==================================================================
   FLASHCARD VERTICAL, AUDIO INTERNO E AVALIACAO NO VERSO
   ================================================================== */
.study-meta { align-items: center; }

.flashcard {
  width: min(390px, 100%);
  height: clamp(480px, 70vh, 620px);
  min-height: 0;
  margin: 0 auto;
}
.flashcard-inner {
  height: 100%;
  min-height: 0;
}
.flashcard-face {
  min-height: 0;
  padding: 1.6rem;
}
.flashcard-front {
  justify-content: center;
  padding-bottom: 3rem;
}
.flashcard-back {
  justify-content: flex-start;
  padding-top: 2.4rem;
  padding-bottom: 1.1rem;
}
.flashcard-front::after { display: none; }
.card-word {
  font-size: clamp(2rem, 4.6vw, 3.25rem);
  line-height: 1.05;
}
.card-word.sentence { font-size: clamp(1.05rem, 2.5vw, 1.45rem); }

.card-turn-hint {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  color: #dc2626;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.card-turn-hint-back {
  position: static;
  transform: none;
  display: block;
  margin: 0.7rem auto 0;
  text-align: center;
}

.audio-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border: 1px solid #fecdd3;
  border-radius: 999px;
  background: #fff1f2;
  color: #b31220;
  padding: 0.38rem 0.7rem;
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
  transition: 0.18s ease;
}
.audio-inline:hover { background: #ffe4e6; transform: translateY(-1px); }
.flashcard-front .audio-inline { margin-top: 0.8rem; }
.card-audio-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin: 0.1rem 0 0.75rem;
}
.card-pronunciation {
  color: #b31220;
  font-size: 0.86rem;
  font-weight: 700;
}
.card-pronunciation:empty { display: none; }

.card-rating-actions {
  width: 100%;
  margin-top: auto;
  padding-top: 0.9rem;
}
.rating-title { margin-bottom: 0.15rem; }
.rating-hint {
  margin: 0 0 0.6rem;
  color: #a1a1aa;
  font-size: 0.66rem;
  text-align: center;
}
.rating-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}
.rating-btn { padding: 0.55rem 0.4rem; }
.rating-btn strong { font-size: 0.8rem; }
.rating-btn span { font-size: 0.62rem; }

.flashcard:focus-visible { outline: none; }
.flashcard:focus-visible .flashcard-face {
  outline: 3px solid #fecdd3;
  outline-offset: 5px;
}

@media (max-width: 720px) {
  .flashcard { width: 100%; height: clamp(480px, 72vh, 620px); }
  .flashcard-face { padding: 1.2rem; }
  .flashcard-front { padding-bottom: 2.8rem; }
  .flashcard-back { padding-top: 2rem; padding-bottom: 1rem; }
}

/* ==================================================================
   CARROSSEL LATERAL E LEGENDA DO CARD
   ================================================================== */
.card-carousel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.card-carousel .flashcard {
  flex: 0 1 390px;
  width: 390px;
  max-width: 100%;
  min-width: 0;
  margin: 0;
}
.carousel-card {
  flex: 0 0 clamp(48px, 9vw, 112px);
  height: clamp(380px, 56vh, 540px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.9rem 0.55rem;
  border: 1px solid #ececef;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 8%, rgba(225, 29, 46, 0.06), transparent 42%),
    #fff;
  color: #71717a;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 16px 40px -24px rgba(24, 24, 27, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  overflow: hidden;
}
.carousel-card:hover {
  transform: translateY(-4px);
  border-color: #fecdd3;
  box-shadow: 0 22px 50px -24px rgba(225, 29, 46, 0.28);
}
.carousel-card:disabled {
  opacity: 0.32;
  cursor: default;
  pointer-events: none;
  box-shadow: none;
}
.carousel-arrow {
  color: #b31220;
  font-size: 2rem;
  font-weight: 800;
  line-height: 0.8;
}
.carousel-label {
  color: #a1a1aa;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.carousel-word {
  max-width: 100%;
  color: #18181b;
  font-size: 0.82rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.carousel-card.is-finish .carousel-arrow { color: #18181b; }

.carousel-mobile-hint {
  display: none;
  margin: 0.45rem 0 0;
  color: #52525b;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
}

/* Legenda de atalhos: dois tons mais escura que o cinza anterior. */
.keyboard-hint {
  color: #52525b;
  font-weight: 600;
}
.keyboard-hint kbd {
  background: #e4e4e7;
  border-color: #d4d4d8;
  color: #3f3f46;
}

/* Nota já escolhida ao revisitar um card. */
.rating-btn.is-selected {
  border-color: #e11d2e;
  background: #fff1f2;
  box-shadow: 0 10px 24px rgba(225, 29, 46, 0.16);
}
.rating-btn.is-selected strong { color: #b31220; }

@media (max-width: 900px) {
  .card-carousel { gap: 0.5rem; }
  .carousel-card { height: clamp(360px, 54vh, 480px); }
  .carousel-word { font-size: 0.7rem; }
  .carousel-label { font-size: 0.55rem; }
}

@media (max-width: 480px) {
  .card-carousel { display: block; }
  .carousel-card { display: none; }
  .card-carousel .flashcard { width: 100%; }
  .carousel-mobile-hint { display: block; }
}

/* ==================================================================
   PALCO DO CARROSSEL E ALERTA DE CLASSIFICACAO
   ================================================================== */
.card-stage {
  --slide-x: 72%;
  position: relative;
  z-index: 3;
  flex: 0 1 390px;
  width: 390px;
  max-width: 100%;
  min-width: 0;
  height: clamp(480px, 70vh, 620px);
  transform: translateX(0);
  opacity: 1;
  transition:
    transform 0.24s cubic-bezier(0.22, 0.61, 0.36, 1),
    opacity 0.24s ease;
  will-change: transform, opacity;
}
.card-stage .flashcard {
  width: 100%;
  height: 100%;
  margin: 0;
}
.card-stage.is-slide-out-next {
  transform: translateX(calc(-1 * var(--slide-x)));
  opacity: 0;
}
.card-stage.is-slide-out-prev {
  transform: translateX(var(--slide-x));
  opacity: 0;
}
.card-stage.is-snap-next {
  transform: translateX(var(--slide-x));
  opacity: 0;
  transition: none;
}
.card-stage.is-snap-prev {
  transform: translateX(calc(-1 * var(--slide-x)));
  opacity: 0;
  transition: none;
}
.flashcard.no-flip-animation .flashcard-inner { transition: none; }
.study-body { overflow-x: hidden; }

.study-alert[hidden] { display: none; }

.study-alert {
  position: fixed;
  inset: 0;
  z-index: 115;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgba(17, 24, 39, 0.62);
  backdrop-filter: blur(2px);
}
.study-alert-card {
  width: min(460px, 100%);
  padding: 1.9rem;
  border: 1px solid #fecdd3;
  border-radius: 22px;
  background: #fff;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.32);
  animation: alert-pop 0.2s ease;
}
@keyframes alert-pop {
  from { transform: translateY(10px) scale(0.985); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.study-alert-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 0.8rem;
  border: 1px solid #fecdd3;
  border-radius: 50%;
  background: #fff1f2;
  color: #b31220;
  font-size: 1.5rem;
  font-weight: 800;
}
.study-alert-card h2 { margin-bottom: 0.5rem; }
.study-alert-card p { margin-bottom: 1.2rem; }
.study-alert-actions {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .card-stage { height: clamp(480px, 72vh, 620px); }
}

@media (prefers-reduced-motion: reduce) {
  .card-stage { transition: none; }
  .study-alert-card { animation: none; }
}

@media (max-width: 480px) {
  .card-stage { width: 100%; --slide-x: 108%; }
  .study-alert-card { padding: 1.4rem 1rem; }
  .study-alert-actions { flex-direction: column; }
  .study-alert-actions .btn { width: 100%; }
}

/* ==================================================================
   Calendário de constância, resumo e recordes
   ================================================================== */
.badge-access {
  background: #ecfdf3;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.7rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.calendar-panel.is-loading {
  opacity: 0.65;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.calendar-nav-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.calendar-nav-btn:hover {
  background: var(--primary-soft);
  border-color: #fecdd3;
}
.calendar-nav-btn.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.calendar-month {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  min-width: 0;
  text-align: center;
}
.calendar-month strong { font-size: 0.85rem; }
.calendar-current-hint {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.calendar-current-link {
  color: var(--primary-dark);
  font-size: 0.64rem;
  font-weight: 700;
  text-decoration: none;
}
.calendar-current-link:hover { text-decoration: underline; }

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.calendar-weekdays span {
  padding: 0.15rem 0;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}
.calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 0.3rem;
}
.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.calendar-day {
  min-height: 54px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.15rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.calendar-day:not(.is-empty):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(24, 24, 27, 0.08);
}
.calendar-day.has-access {
  color: #fff;
  background: linear-gradient(145deg, #22c55e, #16a34a);
  border-color: #15803d;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.18);
}
.calendar-day.has-access .calendar-day-count { color: #dcfce7; }
.calendar-day.is-today {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.calendar-day.is-future {
  color: #c6c6cc;
  background: #fbfbfc;
  border-color: #f1f1f3;
}
.calendar-day.is-empty {
  background: transparent;
  border-color: transparent;
}
.calendar-day-number {
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}
.calendar-day-count {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.8rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
}
.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.calendar-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}
.calendar-legend-dot.has-access {
  background: #16a34a;
  border-color: #15803d;
}
.calendar-legend-dot.is-today {
  border: 2px solid var(--primary);
  background: #fff;
}

.constancy-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.constancy-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}
.constancy-metric {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.constancy-metric span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.constancy-metric strong {
  color: #18181b;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.constancy-metric:nth-child(2) strong { color: #15803d; }
.constancy-metric.metric-review strong { color: var(--primary); }
.constancy-metric:last-child:nth-child(odd) { grid-column: 1 / -1; }
.constancy-metric small {
  color: var(--muted);
  font-size: 0.64rem;
}

.weekly-goal {
  margin-bottom: 0.65rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.weekly-goal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.weekly-goal-head > div {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}
.weekly-goal-head strong { font-size: 0.8rem; }
.weekly-goal-head span {
  color: var(--muted);
  font-size: 0.68rem;
}
.weekly-goal-count {
  color: #15803d;
  font-size: 1rem !important;
  white-space: nowrap;
}
.weekly-goal-track {
  height: 8px;
  margin: 0.55rem 0 0.4rem;
  overflow: hidden;
  border-radius: 99px;
  background: #e9e9ec;
}
.weekly-goal-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4ade80, #16a34a);
  transition: width 0.4s ease;
}
.weekly-goal-note {
  color: var(--muted);
  font-size: 0.68rem;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}
.record-card {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.record-card span {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.record-card strong {
  font-size: 0.9rem;
  line-height: 1.2;
}
.record-card small {
  color: var(--muted);
  font-size: 0.63rem;
}

@media (max-width: 900px) {
  .constancy-summary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .calendar-toolbar { padding: 0.4rem; }
  .calendar-day {
    min-height: 46px;
    padding: 0.25rem 0.3rem;
  }
  .calendar-day-number { font-size: 0.72rem; }
  .calendar-day-count { font-size: 0.5rem; }
  .calendar-weekdays span { font-size: 0.58rem; }
}

@media (max-width: 420px) {
  .calendar-weekdays, .calendar-week { gap: 4px; }
  .calendar-day {
    min-height: 42px;
    border-radius: 8px;
  }
  .calendar-day-count { display: none; }
  .calendar-month strong { font-size: 0.78rem; }
  .calendar-nav-btn {
    width: 30px;
    height: 30px;
  }
  .constancy-metrics, .record-grid { grid-template-columns: 1fr; }
}

/* ==================================================================
   VISUAL EXCLUSIVO PARA CELULAR
   O <html> recebe .device-mobile via static/js/device-detect.js.
   Nenhuma regra desta seção altera o visual de computador.
   ================================================================== */

html.device-mobile {
  -webkit-tap-highlight-color: transparent;
}

html.device-mobile body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.device-mobile .app-shell,
html.device-mobile .auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

/* Cabeçalho fixo e menu lateral */
html.device-mobile .mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 56px;
  padding:
    calc(0.45rem + env(safe-area-inset-top))
    calc(0.8rem + env(safe-area-inset-right))
    0.45rem
    calc(0.8rem + env(safe-area-inset-left));
  position: sticky;
  top: 0;
  z-index: 45;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
}

html.device-mobile .mobile-header .icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 1.2rem;
}
html.device-mobile .mobile-header .brand-mobile .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 0.85rem;
}
html.device-mobile .mobile-header .avatar-small {
  width: 38px;
  height: 38px;
  font-size: 0.85rem;
}

html.device-mobile .app-shell > .session-timer { opacity: 0; pointer-events: none; }
html.device-mobile .mobile-header .session-timer {
  position: static;
  margin-left: auto;
  padding: 0.32rem 0.55rem;
  font-size: 0.68rem;
  box-shadow: none;
  border-color: #dbeafe;
}
html.device-mobile .mobile-header .session-timer-value { font-size: 0.78rem; }
html.device-mobile .mobile-header .session-timer-label { display: none; }

html.device-mobile .sidebar {
  width: min(86vw, 330px);
  transform: translateX(-100%);
  transition: transform 0.24s ease;
  padding:
    calc(1.2rem + env(safe-area-inset-top))
    calc(0.9rem + env(safe-area-inset-right))
    calc(1rem + env(safe-area-inset-bottom))
    calc(0.9rem + env(safe-area-inset-left));
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 50;
  box-shadow: 14px 0 38px rgba(20, 40, 60, 0.18);
}
html.device-mobile body.menu-open .sidebar { transform: translateX(0); }
html.device-mobile body.menu-open .sidebar-overlay {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(18, 33, 48, 0.42);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
html.device-mobile body.menu-open { overflow: hidden; }
html.device-mobile .nav { margin-top: 1.4rem; gap: 0.25rem; }
html.device-mobile .nav-link {
  min-height: 48px;
  padding: 0.7rem 0.75rem;
  font-size: 0.95rem;
}
html.device-mobile .nav-sublink {
  display: flex;
  align-items: center;
  min-height: 42px;
}
html.device-mobile .sidebar-footer .btn { min-height: 44px; }

html.device-mobile .main-area {
  margin-left: 0;
  min-height: 100vh;
  min-height: 100dvh;
}
html.device-mobile .container {
  max-width: 100%;
  padding:
    0.9rem
    calc(0.85rem + env(safe-area-inset-right))
    calc(2.2rem + env(safe-area-inset-bottom))
    calc(0.85rem + env(safe-area-inset-left));
}
html.device-mobile .main-area .container { padding-top: 0.9rem; }

/* Cabeçalhos, botões e formulários */
html.device-mobile h1 { font-size: clamp(1.55rem, 6.5vw, 2rem); }
html.device-mobile .page-head {
  flex-direction: column;
  align-items: stretch;
  gap: 0.7rem;
  margin-bottom: 1rem;
}
html.device-mobile .head-actions {
  width: 100%;
  justify-content: flex-start;
  gap: 0.5rem;
}
html.device-mobile .head-actions .btn { flex: 1 1 auto; }
html.device-mobile .head-actions .level-pill { flex: 1 1 100%; justify-content: center; }

html.device-mobile .btn {
  min-height: 44px;
  padding: 0.7rem 0.9rem;
}
html.device-mobile .btn-small { min-height: 38px; padding: 0.5rem 0.7rem; }
html.device-mobile .btn-large { min-height: 50px; }
html.device-mobile .icon-btn { min-width: 44px; min-height: 44px; }

html.device-mobile .field input,
html.device-mobile .field select,
html.device-mobile .field textarea {
  min-height: 46px;
  padding: 0.68rem 0.75rem;
  font-size: 16px;
}
html.device-mobile .form-row { grid-template-columns: 1fr; }
html.device-mobile .field-inline {
  flex-direction: column;
  align-items: stretch;
}
html.device-mobile .field-inline input,
html.device-mobile .field-inline select { width: 100%; }
html.device-mobile .field-compact { max-width: none; }
html.device-mobile .inline-form { align-items: stretch; }
html.device-mobile .inline-form .btn { width: 100%; }
html.device-mobile .password-toggle {
  padding: 0.6rem;
  font-size: 0.78rem;
}

/* Painéis, cartões e indicadores */
html.device-mobile .panel {
  padding: 1rem;
  border-radius: 16px;
}
html.device-mobile .panel-head { gap: 0.6rem; }
html.device-mobile .panel-head .badge { white-space: normal; }
html.device-mobile .notice {
  padding: 0.8rem 0.9rem;
  font-size: 0.85rem;
}
html.device-mobile .flash { font-size: 0.82rem; }

html.device-mobile .stats-grid,
html.device-mobile .admin-stats,
html.device-mobile .admin-user-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}
html.device-mobile .stat-card {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-start;
  min-height: 0;
  padding: 0.8rem;
  gap: 0.12rem;
  border-radius: 14px;
}
html.device-mobile .stat-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 0.15rem;
  font-size: 0.82rem;
}
html.device-mobile .stat-label {
  flex: none;
  font-size: 0.64rem;
  line-height: 1.25;
}
html.device-mobile .stat-value {
  width: auto;
  font-size: 1.45rem;
}
html.device-mobile .stat-help {
  width: auto;
  margin-left: 0;
  font-size: 0.64rem;
  line-height: 1.3;
}

html.device-mobile .dashboard-grid,
html.device-mobile .dashboard-grid.two,
html.device-mobile .admin-grid,
html.device-mobile .profile-grid,
html.device-mobile .constancy-summary-grid {
  grid-template-columns: 1fr;
  gap: 0.8rem;
}
html.device-mobile .today-total strong { font-size: 2.6rem; }
html.device-mobile .next-level-box {
  align-items: center;
  padding: 0.8rem;
}
html.device-mobile .next-level-box strong { font-size: 0.82rem; }
html.device-mobile .ring {
  width: 50px;
  height: 50px;
}
html.device-mobile .level-row-head {
  grid-template-columns: 28px 1fr auto;
  gap: 0.4rem;
}
html.device-mobile .level-count { display: none; }
html.device-mobile .level-sub { font-size: 0.66rem; }
html.device-mobile .admin-shortcut {
  flex-direction: column;
  align-items: stretch;
  padding: 1rem;
}
html.device-mobile .admin-shortcut .btn { width: 100%; }
html.device-mobile .compact-row { gap: 0.6rem; }
html.device-mobile .compact-meta {
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

/* Tabelas com rolagem horizontal */
html.device-mobile .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
html.device-mobile .table { font-size: 0.78rem; }
html.device-mobile .table th,
html.device-mobile .table td { padding: 0.55rem 0.45rem; }
html.device-mobile .table-manage { min-width: 0; }
html.device-mobile .table-manage thead th:nth-child(3),
html.device-mobile .table-manage thead th:nth-child(4),
html.device-mobile .table-manage thead th:nth-child(5),
html.device-mobile .table-manage thead th:nth-child(6),
html.device-mobile .table-manage thead th:nth-child(7),
html.device-mobile .table-manage tbody tr.user-row > td:nth-child(3),
html.device-mobile .table-manage tbody tr.user-row > td:nth-child(4),
html.device-mobile .table-manage tbody tr.user-row > td:nth-child(5),
html.device-mobile .table-manage tbody tr.user-row > td:nth-child(6),
html.device-mobile .table-manage tbody tr.user-row > td:nth-child(7) { display: none; }
html.device-mobile .row-actions {
  flex-direction: column;
  align-items: stretch;
}
html.device-mobile .row-actions .btn { width: 100%; }

/* Calendário e metas */
html.device-mobile .calendar-toolbar { padding: 0.4rem; }
html.device-mobile .calendar-day {
  min-height: 44px;
  padding: 0.25rem 0.3rem;
  border-radius: 9px;
}
html.device-mobile .calendar-day-number { font-size: 0.74rem; }
html.device-mobile .calendar-day-count { font-size: 0.48rem; }
html.device-mobile .calendar-weekdays span { font-size: 0.58rem; letter-spacing: 0; }
html.device-mobile .calendar-legend {
  gap: 0.35rem 0.7rem;
  font-size: 0.62rem;
}
html.device-mobile .constancy-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.device-mobile .record-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Perfil e administração */
html.device-mobile .detail-list > div { font-size: 0.8rem; }
html.device-mobile .user-create-grid { grid-template-columns: 1fr; }
html.device-mobile .manage-grid { grid-template-columns: 1fr; }
html.device-mobile .manage-panel { padding: 0.8rem 0.6rem 1rem; }
html.device-mobile .manage-head {
  flex-direction: column;
  gap: 0.15rem;
}
html.device-mobile .manage-block { padding: 0.8rem; }
html.device-mobile .manage-actions {
  flex-direction: column;
  align-items: stretch;
}
html.device-mobile .manage-actions form,
html.device-mobile .manage-actions .btn { width: 100%; }

/* Login */
html.device-mobile .login-layout {
  grid-template-columns: 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}
html.device-mobile .login-hero {
  min-height: 0;
  padding:
    calc(1.2rem + env(safe-area-inset-top))
    calc(1.2rem + env(safe-area-inset-right))
    1.4rem
    calc(1.2rem + env(safe-area-inset-left));
  gap: 1rem;
}
html.device-mobile .login-hero h1 {
  font-size: clamp(2rem, 9vw, 2.8rem);
  margin: 0.5rem 0 0.6rem;
}
html.device-mobile .login-hero p { font-size: 0.88rem; margin-bottom: 0; }
html.device-mobile .hero-list,
html.device-mobile .login-hero-foot { display: none; }
html.device-mobile .login-panel {
  justify-content: flex-start;
  padding:
    1rem
    calc(0.9rem + env(safe-area-inset-right))
    calc(2rem + env(safe-area-inset-bottom))
    calc(0.9rem + env(safe-area-inset-left));
}
html.device-mobile .login-card {
  padding: 1.4rem 1.1rem;
  border-radius: 18px;
}
html.device-mobile .login-card h2 { font-size: 1.35rem; }
html.device-mobile .login-copyright {
  position: static;
  margin-top: 1.2rem;
  text-align: center;
}
html.device-mobile .auth-flashes {
  top: calc(0.8rem + env(safe-area-inset-top));
  width: calc(100% - 1.6rem);
}

/* Estudo: card ocupando a tela do celular */
html.device-mobile .study-page { max-width: 100%; }
html.device-mobile .study-topline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
html.device-mobile .study-topline-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
html.device-mobile .study-topline-title .eyebrow { display: none; }
html.device-mobile .study-topline .back-link {
  margin-bottom: 0;
  font-size: 0.8rem;
  white-space: nowrap;
}
html.device-mobile .study-session-actions {
  width: auto;
  justify-content: flex-end;
  gap: 0.3rem;
}
html.device-mobile .study-session-actions .btn {
  min-height: 36px;
  padding: 0.45rem 0.7rem;
  font-size: 0.78rem;
  white-space: nowrap;
}
html.device-mobile .study-progress-track {
  height: 4px;
  margin-bottom: 0.5rem;
}
html.device-mobile .study-meta {
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}
html.device-mobile .mode-badge,
html.device-mobile .state-badge {
  padding: 0.26rem 0.45rem;
  font-size: 0.58rem;
  white-space: nowrap;
}
html.device-mobile .study-counter {
  margin-left: auto;
  padding: 0.3rem 0.5rem;
  font-size: 0.6rem;
  white-space: nowrap;
}
html.device-mobile .card-carousel {
  display: block;
  gap: 0;
  margin-bottom: 0.15rem;
}
html.device-mobile .carousel-card { display: none; }
html.device-mobile .card-stage {
  width: 100%;
  --slide-x: 100%;
  height: clamp(300px, calc(100vh - 235px), 560px);
  height: clamp(300px, calc(100svh - 235px), 560px);
}
html.device-mobile .study-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.3rem;
}
html.device-mobile .study-card-footer .admin-review-toggle {
  flex: 0 0 auto;
  margin-left: 0;
}
html.device-mobile .study-card-footer .carousel-mobile-hint {
  display: block;
  width: auto;
  margin: 0;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(24, 24, 27, 0.05);
  color: #71717a;
  font-size: 0.62rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}
html.device-mobile .flashcard.is-dense .card-answer {
  margin: 0.35rem 0 0.4rem;
  font-size: clamp(1.15rem, 5.5vw, 1.5rem);
}
html.device-mobile .flashcard.is-dense .card-details {
  gap: 0.2rem;
  font-size: 0.72rem;
}
html.device-mobile .flashcard.is-dense .card-details .example {
  margin-top: 0.25rem;
  padding-top: 0.4rem;
  font-size: 0.74rem;
}
html.device-mobile .flashcard.is-dense .card-details .example-translation {
  font-size: 0.68rem;
}
html.device-mobile .flashcard.is-dense .card-audio-row { margin-bottom: 0.35rem; }
html.device-mobile .flashcard.is-dense .card-rating-actions { padding-top: 0.35rem; }
html.device-mobile .flashcard.is-dense .rating-title { font-size: 0.66rem; }
html.device-mobile .flashcard.is-dense .rating-hint { display: none; }
html.device-mobile .flashcard.is-dense .rating-btn {
  min-height: 42px;
  padding: 0.4rem 0.25rem;
}
html.device-mobile .flashcard.is-dense .rating-btn strong { font-size: 0.74rem; }
html.device-mobile .flashcard.is-dense .rating-btn span { font-size: 0.56rem; }
html.device-mobile .flashcard,
html.device-mobile .flashcard-inner,
html.device-mobile .flashcard-face { min-height: 0; }
html.device-mobile .flashcard {
  border-radius: 20px;
  animation: none;
}
html.device-mobile .flashcard-face {
  padding: 1rem;
  border-radius: 20px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
html.device-mobile .flashcard-front { padding-bottom: 2.2rem; }
html.device-mobile .flashcard-back {
  padding-top: 1.6rem;
  padding-bottom: 0.8rem;
}
html.device-mobile .flashcard::before { filter: blur(24px); }
html.device-mobile .card-word { font-size: clamp(2rem, 10vw, 2.9rem); }
html.device-mobile .card-word.sentence { font-size: clamp(1.05rem, 5vw, 1.35rem); }
html.device-mobile .card-answer { font-size: clamp(1.35rem, 7vw, 1.9rem); }
html.device-mobile .card-details { font-size: 0.8rem; }
html.device-mobile .card-details .example { font-size: 0.82rem; }
html.device-mobile .card-audio-row { gap: 0.4rem; margin-bottom: 0.5rem; }
html.device-mobile .audio-inline {
  min-height: 40px;
  padding: 0.45rem 0.75rem;
  font-size: 0.72rem;
}
html.device-mobile .rating-title { font-size: 0.72rem; margin-bottom: 0.1rem; }
html.device-mobile .rating-hint { display: none; }
html.device-mobile .card-rating-actions { padding-top: 0.55rem; }
html.device-mobile .rating-grid { gap: 0.4rem; }
html.device-mobile .rating-btn {
  min-height: 50px;
  justify-content: center;
  padding: 0.5rem 0.3rem;
}
html.device-mobile .rating-btn strong { font-size: 0.8rem; }
html.device-mobile .rating-btn span { font-size: 0.6rem; }
html.device-mobile .keyboard-hint { display: none; }
html.device-mobile .card-turn-hint { bottom: 0.9rem; font-size: 0.64rem; }
html.device-mobile .card-turn-hint-back { margin-top: 0.5rem; }
html.device-mobile .study-shell {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
html.device-mobile .study-start,
html.device-mobile .study-finish,
html.device-mobile .empty-state {
  padding: 1.6rem 1rem;
  border-radius: 18px;
}
html.device-mobile .study-start .btn,
html.device-mobile .finish-actions .btn { width: 100%; }
html.device-mobile .start-stats { gap: 0.45rem; }
html.device-mobile .start-stat {
  flex: 1 1 30%;
  min-width: 0;
  padding: 0.6rem 0.5rem;
}
html.device-mobile .start-stat strong { font-size: 1.2rem; }
html.device-mobile .start-stat span {
  font-size: 0.58rem;
  letter-spacing: 0.02em;
}
html.device-mobile .finish-stats { gap: 0.8rem; }

/* Avisos e diálogos como painel inferior */
html.device-mobile .study-alert,
html.device-mobile .session-warning {
  align-items: end;
  padding: 0.5rem;
}
html.device-mobile .study-alert-card,
html.device-mobile .session-warning-card {
  width: 100%;
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  padding:
    1.4rem 1rem
    calc(1.4rem + env(safe-area-inset-bottom));
  border-radius: 22px 22px 14px 14px;
}
html.device-mobile .study-alert-actions { flex-direction: column; }
html.device-mobile .study-alert-actions .btn { width: 100%; }

/* Toque: sem efeitos de hover que deslocam o conteúdo */
@media (hover: none) {
  html.device-mobile .panel:hover,
  html.device-mobile .stat-card:hover,
  html.device-mobile .carousel-card:hover,
  html.device-mobile .rating-btn:hover,
  html.device-mobile .btn:hover {
    transform: none;
  }
  html.device-mobile .flashcard:hover .flashcard-face {
    box-shadow:
      0 34px 80px -34px rgba(24, 24, 27, 0.38),
      0 16px 34px rgba(24, 24, 27, 0.07),
      inset 0 1px 0 #ffffff;
  }
}

/* Telas muito estreitas */
@media (max-width: 360px) {
  html.device-mobile .container {
    padding-left: calc(0.7rem + env(safe-area-inset-left));
    padding-right: calc(0.7rem + env(safe-area-inset-right));
  }
  html.device-mobile .stat-value { font-size: 1.3rem; }
  html.device-mobile .stat-label,
  html.device-mobile .stat-help { font-size: 0.6rem; }
  html.device-mobile .mode-badge,
  html.device-mobile .state-badge {
    padding: 0.22rem 0.38rem;
    font-size: 0.54rem;
  }
  html.device-mobile .study-counter {
    padding: 0.24rem 0.4rem;
    font-size: 0.56rem;
  }
  html.device-mobile .study-card-footer .carousel-mobile-hint {
    padding: 0.26rem 0.45rem;
    font-size: 0.56rem;
  }
  html.device-mobile .study-topline .back-link { font-size: 0.74rem; }
  html.device-mobile .study-session-actions .btn {
    padding: 0.42rem 0.55rem;
    font-size: 0.72rem;
  }
}

/* Celular deitado: compacta o topo para o card caber na tela */
@media (orientation: landscape) and (max-height: 520px) {
  html.device-mobile .login-hero { display: none; }
  html.device-mobile .mobile-header {
    min-height: 48px;
    padding-top: calc(0.25rem + env(safe-area-inset-top));
    padding-bottom: 0.25rem;
  }
  html.device-mobile .mobile-header .icon-btn {
    width: 40px;
    height: 40px;
  }
  html.device-mobile .mobile-header .brand-mobile .brand-mark,
  html.device-mobile .mobile-header .avatar-small {
    width: 34px;
    height: 34px;
  }
  html.device-mobile .study-topline {
    flex-direction: row;
    align-items: center;
    margin-bottom: 0.3rem;
  }
  html.device-mobile .study-topline .back-link,
  html.device-mobile .study-topline .eyebrow { display: none; }
  html.device-mobile .study-progress-track { margin-bottom: 0.4rem; }
  html.device-mobile .study-meta { margin-bottom: 0.35rem; }
  html.device-mobile .card-stage {
    height: calc(100vh - 125px);
    height: calc(100dvh - 125px);
    min-height: 245px;
  }
  html.device-mobile .flashcard-face { padding: 0.8rem; }
  html.device-mobile .card-word { font-size: clamp(1.5rem, 6vw, 2.2rem); }
  html.device-mobile .card-answer { font-size: clamp(1.1rem, 4vw, 1.5rem); }
  html.device-mobile .card-rating-actions { padding-top: 0.35rem; }
  html.device-mobile .rating-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  html.device-mobile .rating-btn {
    min-height: 46px;
    padding: 0.35rem 0.2rem;
  }
  html.device-mobile .rating-btn span { display: none; }
  html.device-mobile .card-turn-hint { display: none; }
  html.device-mobile .carousel-mobile-hint { display: none; }
}

/* ==================================================================
   ADMINISTRAÇÃO · BUSCA E CORREÇÃO DE FLASHCARDS
   ================================================================== */
.card-search-panel {
  position: relative;
  z-index: 20;
}

.card-search-form {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
}
.card-search-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.card-search-results {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow:
    0 24px 55px -22px rgba(24, 24, 27, 0.32),
    0 8px 18px rgba(24, 24, 27, 0.06);
}
.card-search-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}
.card-search-option:hover,
.card-search-option:focus-visible,
.card-search-option.is-active {
  outline: none;
  background: var(--primary-soft);
  text-decoration: none;
}
.card-search-option-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.card-search-option-main strong {
  font-size: 0.88rem;
  line-height: 1.25;
}
.card-search-option-main span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-search-option-meta {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem;
}
.card-search-empty {
  padding: 0.85rem 0.7rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}
.card-search-help { margin: 0.6rem 0 0; }

.card-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.9rem;
}
.card-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  transition: 0.16s ease;
}
.card-result:hover {
  border-color: #fecdd3;
  background: #fffafa;
  text-decoration: none;
}
.card-result.is-current {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.card-result-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.card-result-main strong {
  font-size: 0.9rem;
  line-height: 1.25;
}
.card-result-main span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-result-meta {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem;
}

.card-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.card-edit-form textarea {
  min-height: 66px;
  resize: vertical;
}
.card-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.15rem;
}
.card-edit-meta {
  margin-top: 1rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--line);
}
.card-edit-panel { scroll-margin-top: 80px; }

html.device-mobile .card-search-form {
  flex-direction: column;
  align-items: stretch;
}
html.device-mobile .card-edit-panel { scroll-margin-top: 72px; }
html.device-mobile .card-search-form .btn { width: 100%; }
html.device-mobile .card-search-results { max-height: 55vh; }
html.device-mobile .card-result {
  flex-direction: column;
  align-items: flex-start;
}
html.device-mobile .card-result-meta { justify-content: flex-start; }
html.device-mobile .card-edit-actions {
  flex-direction: column;
  align-items: stretch;
}
html.device-mobile .card-edit-actions .btn { width: 100%; }

/* ==================================================================
   ADMIN REVIEW · marcação no card e lista de revisão
   ================================================================== */
.study-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.35rem;
}
.study-card-footer .carousel-mobile-hint {
  display: none;
  margin: 0;
}
.study-card-footer .admin-review-toggle { margin-left: 0; }
.study-counter { margin-left: auto; }
.study-meta .admin-review-toggle { margin-left: auto; }
.admin-review-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: 36px;
  padding: 0.34rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #71717a;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  user-select: none;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}
.admin-review-toggle:hover {
  border-color: #fecdd3;
  background: #fffafa;
}
.admin-review-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.admin-review-check {
  position: relative;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 1.5px solid #d4d4d8;
  border-radius: 5px;
  background: #fff;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.admin-review-check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.12s ease;
}
.admin-review-toggle input:checked + .admin-review-check {
  background: var(--primary);
  border-color: var(--primary);
}
.admin-review-toggle input:checked + .admin-review-check::after {
  transform: rotate(45deg) scale(1);
}
.admin-review-toggle.is-checked {
  border-color: #fecdd3;
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(225, 29, 46, 0.1);
}
.admin-review-toggle input:focus-visible + .admin-review-check {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.card-review-notice { margin-bottom: 1rem; }
.card-review-notice .muted { display: block; margin-top: 0.2rem; }

.review-panel .table-review { min-width: 760px; }
.review-translation {
  max-width: 260px;
  overflow-wrap: anywhere;
  font-weight: 700;
}
.review-users {
  display: block;
  max-width: 220px;
  overflow-wrap: anywhere;
  font-size: 0.8rem;
}
.review-panel .row-actions { flex-wrap: nowrap; }

html.device-mobile .admin-review-toggle {
  min-height: 34px;
  padding: 0.3rem 0.55rem;
  font-size: 0.6rem;
}
html.device-mobile .review-panel .table-review { min-width: 640px; }
html.device-mobile .table-review thead th:nth-child(5),
html.device-mobile .table-review tbody td:nth-child(5) { display: none; }
html.device-mobile .review-panel .row-actions {
  flex-direction: column;
  align-items: stretch;
}
html.device-mobile .review-panel .row-actions .btn { width: 100%; }


