:root {
  --opisto-primary: #22c55e;
  --opisto-primary-dark: #16a34a;
  --opisto-blue: #2563eb;

  --opisto-bg: #f7faf8;
  --opisto-card: #ffffff;
  --opisto-border: #d8e2dc;

  --opisto-text: #1f2a44;
  --opisto-heading: #172554;
  --opisto-muted: #667085;

  --opisto-success-bg: #e8f7e8;
  --opisto-active-bg: #eef6ff;
  --opisto-hint-bg: #fef08a;
  --opisto-hint-border: #f59e0b;

  --opisto-radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, system-ui, sans-serif;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
  background: var(--opisto-bg);
  color: var(--opisto-text);
  text-align: left;
  font-size: 17px;
  line-height: 1.45;
}

h1,
h2,
h3,
#listTitle,
.name {
  color: var(--opisto-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 34px;
  margin: 0 0 8px;
}

h2 {
  font-size: 25px;
  margin: 24px 0 10px;
}

p {
  margin-top: 8px;
}

label {
  font-weight: 500;
}

select,
button,
input {
  font-family: inherit;
  padding: 10px 12px;
  margin: 6px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid var(--opisto-border);
}

input {
  width: 70%;
  max-width: 420px;
}

button {
  background: var(--opisto-primary);
  color: #ffffff;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: var(--opisto-primary-dark);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.card,
.list-card {
  background: var(--opisto-card);
  border: 1px solid var(--opisto-border);
  border-radius: var(--opisto-radius);
  padding: 20px;
  margin: 14px 0;
  box-shadow: 0 3px 10px rgba(0,0,0,0.04);
  text-align: left;
}

.list-card.completed {
  background: var(--opisto-success-bg);
}

.list-card.active {
  border: 2px solid var(--opisto-blue);
  background: var(--opisto-active-bg);
}

.list-card.locked {
  opacity: 0.45;
}

.list-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.position {
  font-weight: 600;
  color: var(--opisto-muted);
  margin-right: 8px;
}

.name {
  font-size: 20px;
}

.meta,
.progress {
  color: var(--opisto-muted);
  font-size: 15px;
  margin-top: 6px;
}

.actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word,
#questionWord {
  font-size: 46px;
  line-height: 1.1;
  margin: 20px 0 24px;
  font-weight: 600;
  color: var(--opisto-heading);
}

.feedback {
  font-size: 22px;
  min-height: 35px;
  margin-top: 15px;
}

.choice {
  display: block;
  width: 100%;
  margin: 10px 0;
  padding: 13px;
  font-size: 19px;
}

.correct {
  background: #d8f5d8 !important;
}

.wrong {
  background: #f7d6d6 !important;
}

#grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  margin: 18px 0;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--opisto-border);
  border-radius: 7px;
  background: #ffffff;
  color: #172554;
  cursor: pointer;
  user-select: none;
  font-family: Inter, system-ui, sans-serif;
  font-size: 22px;
  font-weight: 500;
}

.cell.selected {
  background: var(--opisto-blue) !important;
  color: #ffffff !important;
}

.cell.correct {
  background: #facc15 !important;
  color: #1f2937 !important;
}

.cell.hint {
  background: var(--opisto-hint-bg) !important;
  border-color: var(--opisto-hint-border) !important;
  color: #92400e !important;
  box-shadow: inset 0 0 0 1px var(--opisto-hint-border);
  transform: none !important;
  position: static !important;
  top: auto !important;
  left: auto !important;
  margin: 0 !important;
}

.findword-tools {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

.findword-tools button {
  padding: 7px 10px;
  font-size: 14px;
  min-height: auto;
}

.findword-sparkle {
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
  border-radius: 50%;
  z-index: 9999;
  opacity: 0;
  background: radial-gradient(circle, #fff3b0 0%, #facc15 60%, rgba(0,0,0,0) 100%);
  animation: findwordSparkleFlash 2s linear forwards;
}

@keyframes findwordSparkleFlash {
  0% { opacity: 0; transform: scale(0.3); }
  10% { opacity: 1; transform: scale(1.1); }
  30% { opacity: 0.2; }
  60% { opacity: 1; transform: scale(0.8); }
  100% { opacity: 0; transform: scale(0.2); }
}

.cell.selected {
  background: #4a90e2 !important;
  color: white !important;
}

.cell.correct {
  background: #4caf50 !important;
  color: white !important;
}

.cell,
.cell.selected,
.cell.correct,
.cell.hint {
  font-size: 20px !important;
  font-weight: 500 !important;
}

.findword-sparkle {
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
  border-radius: 50%;
  z-index: 9999;
  opacity: 0;
  background: radial-gradient(circle, #fff3b0 0%, #facc15 60%, rgba(0,0,0,0) 100%);
  animation: findwordSparkleFlash 2s linear forwards;
}

@keyframes findwordSparkleFlash {
  0% { opacity: 0; transform: scale(0.3); }
  10% { opacity: 1; transform: scale(1.1); }
  30% { opacity: 0.2; }
  60% { opacity: 1; transform: scale(0.8); }
  100% { opacity: 0; transform: scale(0.2); }
}

.choice {
  width: 100%;
  max-width: 460px;
  margin: 10px auto;
  background: #5fbf6d;
  color: #ffffff;
  border-radius: 12px;
  font-weight: 600;
}

.choice:hover {
  background: #4faf5d;
}

@media (max-width: 640px) {
  body {
    width: 100%;
    max-width: none;
    padding: 16px 14px;
    font-size: 21px;
    line-height: 1.35;
  }

  h1 {
    font-size: 34px;
    line-height: 1.15;
  }

  h2,
  #listTitle {
    font-size: 25px;
    line-height: 1.2;
  }

  .name {
    font-size: 21px;
  }

  label,
  p,
  .hint,
  .meta,
  .progress,
  #statsText,
  #progressText,
  #languageInfo,
  #pathDescription {
    font-size: 20px;
  }

  select,
  input {
    width: 100%;
    margin: 6px 0;
    font-size: 19px;
    padding: 12px 14px;
  }

  button {
    width: 100%;
    margin: 6px 0;
    font-size: 18px;
    padding: 12px 14px;
  }

  .card,
  .list-card {
    width: 100%;
    padding: 20px 16px;
    margin: 12px 0;
  }

  .list-top {
    flex-direction: column;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .actions button {
    width: 100%;
    margin: 0;
    font-size: 17px;
    padding: 10px 6px;
    min-height: 46px;
  }

  .word,
  #questionWord {
    font-size: 40px;
    line-height: 1.05;
    margin: 18px 0 26px;
  }

  .choice {
    font-size: 22px;
    min-height: 54px;
  }

  #grid {
    gap: 3px;
  }

  .cell {
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
  }

  .findword-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .findword-tools button {
    width: 100%;
    margin: 0;
    font-size: 15px;
    padding: 8px 8px;
  }

.cell,
.cell.selected,
.cell.correct,
.cell.hint {
  font-size: 14px !important;
  font-weight: 500 !important;
}

.choice {
  max-width: none;
  width: 100%;
  font-size: 22px;
  min-height: 54px;
}

}

.opisto-start-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0;
}

.opisto-start-menu button {
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
}

@media (max-width: 640px) {
  .opisto-start-menu {
    grid-template-columns: 1fr;
  }

  .opisto-start-menu button {
    font-size: 18px;
    padding: 14px 16px;
  }
}

.opisto-logo-wrap {
  text-align: center;
  margin-bottom: 24px;
}

.opisto-logo {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: 2px;
}

.logo-a { color:#2563eb; }
.logo-b { color:#f97316; }
.logo-c { color:#16a34a; }
.logo-d { color:#7c3aed; }

.logo-o,
.logo-p,
.logo-i,
.logo-s,
.logo-t,
.logo-o2 {
  color:#172554;
}

.opisto-tagline {
  margin-top: 6px;
  color: #64748b;
  font-size: 15px;
}

@media (max-width:640px){

  .opisto-logo{
    font-size:38px;
  }

  .opisto-tagline{
    font-size:14px;
  }
}

.opisto-home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.opisto-home-card h2 {
  margin-top: 0;
}

.opisto-home-card p {
  color: var(--opisto-muted);
}

@media (max-width: 640px) {
  .opisto-home-grid {
    grid-template-columns: 1fr;
  }
}

textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  font-family: inherit;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid var(--opisto-border);
  resize: vertical;
}

@media (max-width: 640px) {
  textarea {
    font-size: 18px;
    min-height: 140px;
  }
}

.opisto-footer-link {
  text-align: center;
  margin: 28px 0 12px;
  font-size: 0.95rem;
}

.opisto-footer-link a {
  color: var(--opisto-text);
  text-decoration: none;
}

.opisto-footer-link a:hover {
  text-decoration: underline;
}


.library-lists{
  margin-top:14px;
}

.library-card{
  background:#ffffff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:14px;
  margin:12px 0;
  box-shadow:0 4px 14px rgba(15,23,42,.06);
}

.library-title{
  font-weight:800;
  font-size:1.05rem;
  color:#111827;
  margin-bottom:4px;
}

.library-meta{
  color:#6b7280;
  font-size:.92rem;
  margin-bottom:10px;
}

.library-preview{
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  background:#f9fafb;
  border:1px solid #e5e7eb;
}

.library-preview-title{
  font-weight:800;
  margin-bottom:8px;
  color:#374151;
}

.library-preview-word{
  display:block;
  padding:3px 0;
  color:#111827;
}

.opisto-hidden{
  display:none;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.15), transparent 30%),
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.14), transparent 28%),
    linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  color: #111827;
}

.practice-topbar {
  width: min(920px, calc(100% - 32px));
  margin: 18px auto 0;
}

.btn-back {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.82);
  color: #374151;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(15,23,42,0.08);
}

.practice-page {
  width: min(920px, calc(100% - 32px));
  margin: 22px auto 40px;
}

.practice-card {
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(148,163,184,0.32);
  border-radius: 28px;
  padding: clamp(22px, 4vw, 38px);
  box-shadow: 0 22px 55px rgba(15,23,42,0.12);
}

.practice-card h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

#practiceTitle {
  margin: 0 0 8px;
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  color: #4f46e5;
}

#practiceInfo,
#practiceStatus {
  color: #64748b;
  font-weight: 600;
}

.practice-card label {
  display: block;
  margin-top: 22px;
  margin-bottom: 8px;
  font-weight: 900;
  color: #374151;
}

#practiceMode {
  width: 100%;
  max-width: 360px;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 13px 14px;
  font-size: 1rem;
  font-weight: 700;
  background: #fff;
}

.practice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.practice-actions button {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 900;
  background: #ffffff;
  color: #334155;
  box-shadow: 0 8px 20px rgba(15,23,42,0.08);
}

.practice-actions button:first-child {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #ffffff;
}

.practice-actions button:hover,
.btn-back:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(15,23,42,0.12);
}

@media (max-width: 640px) {
  .practice-actions {
    flex-direction: column;
  }

  .practice-actions button,
  #practiceMode {
    width: 100%;
  }
}

.practice-logo-wrap {
  text-align: center;
  margin: 12px auto 18px;
}

.opisto-logo {
  font-size: clamp(2.2rem, 8vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.08em;
  line-height: 1;
}

.logo-a { color: #2563eb; }
.logo-b { color: #f97316; }
.logo-c { color: #16a34a; }
.logo-d { color: #7c3aed; }

.logo-o,
.logo-p,
.logo-i,
.logo-s,
.logo-t,
.logo-o2 {
  color: #111827;
}

.opisto-tagline {
  margin-top: 8px;
  color: #64748b;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.finish-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.finish-actions button {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 900;
  background: #ffffff;
  color: #334155;
  box-shadow: 0 8px 20px rgba(15,23,42,0.08);
}

.finish-actions button:first-child {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
}

.opisto-breadcrumb {
  width: min(920px, calc(100% - 32px));
  margin: 8px auto 18px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  color: #475569;
  font-weight: 800;
  font-size: 0.92rem;
  text-align: center;
  box-shadow: 0 8px 20px rgba(15,23,42,0.07);
}

.opisto-breadcrumb .sep {
  color: #94a3b8;
  margin: 0 6px;
}

.opisto-breadcrumb .current {
  color: #4f46e5;
}

.soft-divider {
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  margin: 18px 0;
}

.finish-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 10px;
}

.finish-score {
  font-size: 48px;
  font-weight: 800;
  color: #2563eb;
  margin-bottom: 15px;
}

.finish-stats {
  margin-bottom: 20px;
}

.finish-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
