/* Teacher page: the old WordNerd dashboard (reference/screens/dashboard-empty.jpg) – a dark board, wooden
   tabs on both sides of a central panel, the logo plank on top, a name bar below – made phone-first:
   under 900 px the tabs become a bottom bar. Raw colours come from tokens.css via the --c-* roles. */

:root {
  --wood-grain: repeating-linear-gradient(92deg, rgb(255 255 255 / .035) 0 2px, transparent 2px 9px, rgb(0 0 0 / .05) 9px 11px, transparent 11px 19px);
  --wood: var(--wood-grain), linear-gradient(170deg, #b06a33, #7a4420);
  --wood-light: var(--wood-grain), linear-gradient(170deg, #c47a3d, #8f5226);
  --board: radial-gradient(circle at 20% 10%, rgb(255 255 255 / .03), transparent 40%), repeating-linear-gradient(0deg, rgb(255 255 255 / .012) 0 1px, transparent 1px 3px), var(--c-bg);
}

body.teacher { background: var(--board); background-attachment: fixed; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--c-text-muted); }
.small { font-size: .88rem; }
.msg { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--wn-radius-sm); }
.msg-error { background: rgb(175 17 30 / .25); border: 1px solid #c0392b; color: #ffd6d2; }
.msg-note { background: rgb(114 217 10 / .15); border: 1px solid rgb(114 217 10 / .5); color: #dff5c6; }
.link-btn { background: none; border: 0; padding: 0; color: var(--c-accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn.danger { color: #ff9f95; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--c-wood-line); background: transparent; color: var(--c-text-muted); font-size: 1.3rem; line-height: 1; cursor: pointer; flex: none; }
.icon-btn:hover { color: #fff; background: rgb(255 255 255 / .08); }
.btn-primary { background: linear-gradient(#ffb04a, #e08a12); color: #2b1a08; border-color: #ffcf8a; }
.btn-primary:hover, .btn-primary:focus-visible { color: #000; }
.btn-wide { width: 100%; text-align: center; }
.btn-big { padding: 13px 28px; font-size: 1.08rem; }
.btn:not(.btn-primary):not(.btn-ghost) { background: var(--wood); }

/* form fields */
.field { display: grid; gap: 6px; margin: 0 0 14px; color: var(--c-text-muted); font-size: .92rem; }
.field input, .field select, .field textarea, .list-title {
  font: inherit; font-size: 1rem; padding: 9px 12px; border-radius: var(--wn-radius-sm);
  border: 1px solid var(--c-wood-line); background: var(--c-field); color: var(--c-field-text); width: 100%;
}
.field textarea { resize: vertical; min-height: 220px; line-height: 1.45; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }

/* ---------- loading and sign-in ---------- */
.loading { min-height: 100vh; display: grid; place-items: center; }
.loading-logo { width: min(320px, 70vw); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.signin { min-height: 100vh; display: grid; justify-items: center; align-content: center; gap: 18px; padding: 32px var(--wn-space); }
.signin-logo { width: min(380px, 80vw); height: auto; }
.signin-card {
  width: min(420px, 100%); padding: 26px 24px; border-radius: var(--wn-radius-md);
  background: var(--c-panel); border: 2px solid var(--c-wood-line); box-shadow: 0 8px 0 rgb(0 0 0 / .25);
}
.signin-card h1 { margin: 0 0 6px; }
.eyebrow { margin: 0 0 4px; color: var(--c-accent); font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; }
.or { display: flex; align-items: center; gap: 10px; color: var(--c-text-muted); margin: 14px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--c-wood-line); }
.links { margin: 10px 0 0; text-align: center; color: var(--c-text-muted); }

/* ---------- dashboard ---------- */
.dash {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) 150px; grid-template-areas: 'top top top' 'left panel right' 'name name name';
  gap: 0 14px; max-width: 1240px; margin: 0 auto; padding: 0 var(--wn-space) 28px;
}
.dash-top { grid-area: top; display: flex; justify-content: center; }
.dash-logo {
  display: block; padding: 14px 44px 10px; margin-bottom: -8px; border-radius: 0 0 22px 22px; background: var(--wood);
  border: 2px solid var(--wn-wood-line); border-top: 0; box-shadow: 0 6px 0 rgb(0 0 0 / .3); position: relative; z-index: 2;
}
.dash-logo img { width: min(300px, 60vw); height: auto; display: block; }
.tabs { display: flex; flex-direction: column; gap: 12px; padding-top: 34px; }
.tabs-left { grid-area: left; }
.tabs-right { grid-area: right; }
.tab {
  display: grid; justify-items: center; gap: 8px; padding: 18px 8px 14px; border-radius: var(--wn-radius-md);
  background: var(--wood); border: 2px solid var(--wn-wood-line); box-shadow: 0 5px 0 rgb(0 0 0 / .3);
  color: var(--wn-amber-500); text-decoration: none; font: 1.05rem var(--wn-font-display); letter-spacing: .04em; text-align: center;
  transition: transform .12s ease, background .2s;
}
.tab:hover { transform: translateY(-2px); }
.tab .icon { width: 40px; height: 40px; filter: drop-shadow(0 2px 1px rgb(0 0 0 / .35)); }
.tab.is-active { background: var(--wood-light); color: #fff3d6; outline: 3px solid var(--wn-amber-500); outline-offset: -3px; }
.panel {
  grid-area: panel; min-height: 520px; margin-top: 20px; padding: 34px clamp(16px, 3vw, 34px) 30px;
  background: linear-gradient(rgb(0 0 0 / .18), rgb(0 0 0 / .18)), var(--c-panel);
  border: 10px solid transparent; border-image: linear-gradient(170deg, #b06a33, #6e3d1c) 1;
  box-shadow: inset 0 0 40px rgb(0 0 0 / .4), 0 8px 0 rgb(0 0 0 / .25);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-title { margin: 0; font-size: 1.6rem; }
.namebar {
  grid-area: name; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 18px auto 0; padding: 10px 20px;
  max-width: 720px; width: 100%; border-radius: 16px; background: var(--wood); border: 2px solid var(--wn-wood-line); box-shadow: 0 6px 0 rgb(0 0 0 / .3);
}
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--c-bg-deep); color: var(--wn-amber-500); font-weight: 600; border: 2px solid var(--wn-amber-500); }
.who { display: grid; flex: 1 1 160px; min-width: 0; }
.who-name { color: #fff3d6; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-credits { color: var(--wn-amber-500); font-size: .92rem; }

@media (max-width: 899px) {
  .dash { grid-template-columns: 1fr; grid-template-areas: 'top' 'name' 'panel'; padding-bottom: 96px; }
  .dash-logo { padding: 10px 26px 8px; }
  .dash-logo img { width: min(220px, 55vw); }
  .namebar { margin-top: 18px; padding: 8px 12px; gap: 8px; flex-wrap: nowrap; }
  .namebar .btn-small { padding: 6px 10px; white-space: nowrap; }
  .namebar .link-btn { white-space: nowrap; font-size: .9rem; }
  .avatar { width: 34px; height: 34px; }
  .panel { margin-top: 14px; min-height: 0; padding: 22px 14px; border-width: 6px; }
  /* the four tabs become one bar at the bottom of the screen */
  .tabs { position: fixed; bottom: 0; z-index: 20; flex-direction: row; gap: 4px; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--wood); border-top: 2px solid var(--wn-wood-line); }
  .tabs-left { left: 0; width: 50%; }
  .tabs-right { right: 0; width: 50%; }
  .tab { flex: 1; padding: 6px 2px; gap: 2px; font-size: .78rem; box-shadow: none; border: 0; background: transparent; }
  .tab .icon { width: 26px; height: 26px; }
  .tab.is-active { background: rgb(0 0 0 / .2); outline: 0; }
  .tab:hover { transform: none; }
}

/* ---------- My lists ---------- */
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card {
  display: grid; gap: 6px; height: 100%; padding: 16px 18px; border-radius: var(--wn-radius-md); text-decoration: none;
  background: var(--c-field); color: var(--c-field-text); box-shadow: 0 4px 0 var(--wn-wood-700); border: 2px solid transparent;
  transition: transform .12s ease, border-color .12s;
}
.card:hover, .card:focus-visible { transform: translateY(-2px); border-color: var(--wn-amber-500); }
.card-title { font: 600 1.1rem var(--wn-font-body); color: var(--wn-wood-700); }
.card-meta { font-size: .9rem; color: #6b5a44; }
.card-date { font-size: .82rem; color: #8f7c62; }
.empty { text-align: center; padding: 40px 10px; display: grid; gap: 8px; justify-items: center; }

/* ---------- New list ---------- */
.new-form { margin-top: 10px; }
.segs { display: inline-flex; border: 1px solid var(--c-wood-line); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.seg { background: transparent; color: var(--c-text-muted); border: 0; padding: 8px 18px; font: 600 .95rem var(--wn-font-body); cursor: pointer; }
.seg.is-on { background: var(--wn-amber-500); color: #2b1a08; }
.counter { font-size: .85rem; color: var(--c-text-muted); justify-self: end; }
.counter.is-bad { color: #ff9f95; }
.dropzone {
  display: block; padding: 34px 18px; text-align: center; border: 2px dashed var(--c-wood-line); border-radius: var(--wn-radius-md);
  cursor: pointer; color: var(--c-text); background: rgb(0 0 0 / .15);
}
.dropzone.is-over, .dropzone:hover { border-color: var(--wn-amber-500); }
.dropzone.has-file { border-style: solid; border-color: var(--c-ok); }
.cost { margin: 4px 0 16px; color: var(--c-text-muted); }
.cost.is-bad { color: #ffb39a; }

/* waiting overlay and preview overlay */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgb(20 15 10 / .82); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.wait { text-align: center; display: grid; gap: 10px; justify-items: center; }
.wait-logo { width: min(300px, 70vw); animation: pulse 1.4s ease-in-out infinite; }
.wait-line { font: 1.4rem var(--wn-font-display); letter-spacing: .03em; color: var(--wn-amber-500); margin: 0; }

/* ---------- list editor ---------- */
.back { color: var(--c-accent); text-decoration: none; }
.list-title { font: 600 1.35rem var(--wn-font-body); margin: 4px 0 6px; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; margin-top: 10px; }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } }
/* word and translation side by side, the definition on its own line under them */
.words-head, .word-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
.word-fields .w-def { grid-column: 1 / -1; }
.words-head { padding: 0 44px 6px 36px; color: var(--c-accent); font-size: .85rem; }
.word-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.word { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: var(--wn-radius-sm); background: rgb(0 0 0 / .18); border: 1px solid transparent; }
.word.is-bad { border-color: #c0392b; background: rgb(175 17 30 / .2); }
.word.is-added { border-color: rgb(248 184 86 / .4); }
.word-num { width: 26px; padding-top: 8px; text-align: right; color: var(--c-text-muted); font-size: .85rem; flex: none; }
.word-fields { flex: 1; min-width: 0; }
.word-fields input { width: 100%; font: inherit; font-size: .95rem; padding: 6px 9px; border-radius: 5px; border: 1px solid var(--c-wood-line); background: var(--c-field); color: var(--c-field-text); min-width: 0; }
.word-fields .w-term { font-weight: 600; }
.w-ex { grid-column: 1 / -1; margin: 0; font-size: .82rem; color: var(--c-text-muted); font-style: italic; }
@media (max-width: 640px) { .words-head { display: none; } }
.games h3 { margin: 0 0 10px; }
.game-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.game-btn {
  width: 100%; text-align: left; display: grid; gap: 2px; padding: 10px 14px; border-radius: var(--wn-radius-sm); cursor: pointer;
  background: var(--wood); border: 1px solid var(--wn-wood-line); box-shadow: 0 3px 0 rgb(0 0 0 / .3); color: var(--wn-amber-500); font: inherit;
}
.game-btn:hover { background: var(--wood-light); }
.game-btn.is-off { opacity: .5; cursor: default; }
.game-name { font-weight: 600; }
.game-blurb { font-size: .82rem; color: #f1ddba; }
.savebar {
  position: sticky; bottom: 12px; z-index: 10; margin-top: 18px; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 10px 14px; border-radius: 12px; background: var(--c-bg-deep); border: 2px solid var(--wn-amber-500); box-shadow: 0 8px 20px rgb(0 0 0 / .4);
}
.savebar span { margin-right: auto; color: var(--wn-amber-500); font-weight: 600; }
@media (max-width: 899px) { .savebar { bottom: 82px; } }

/* preview overlay */
.pv {
  width: min(980px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 18px clamp(12px, 3vw, 26px) 22px;
  border-radius: var(--wn-radius-md); background: var(--c-panel); border: 2px solid var(--c-wood-line); box-shadow: 0 10px 30px rgb(0 0 0 / .5);
}
.pv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pv-head h3 { margin: 0; }
.pv-settings { margin: 0 0 16px; padding: 10px 12px; border-radius: var(--wn-radius-sm); background: rgb(0 0 0 / .18); }
.pv-settings summary { cursor: pointer; color: var(--c-accent); }
.set-form { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.set-field { display: grid; gap: 4px; font-size: .88rem; color: var(--c-text-muted); }
.set-field input, .set-field select { font: inherit; padding: 6px 10px; border-radius: var(--wn-radius-sm); border: 1px solid var(--c-wood-line); background: var(--c-field); color: var(--c-field-text); }
.set-field input[type="number"] { width: 90px; }
