:root {
  color-scheme: light;
  --ink: #17181c;
  --muted: #667085;
  --line: #d7deea;
  --panel: #ffffff;
  --wash: #edf2f8;
  --soft: #f8fafc;
  --blue: #4257ff;
  --blue-dark: #2f41d8;
  --cyan: #00a6d6;
  --coral: #ff6b5f;
  --gold: #f3b23c;
  --green: #078669;
  --amber: #b7791f;
  --red: #d92d20;
  --shadow: 0 22px 54px rgba(31, 37, 68, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 5.4rem;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(0, 86, 96, 0.18), rgba(0, 86, 96, 0.28)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='300' viewBox='0 0 420 300'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.032 .095' numOctaves='5' seed='29' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .38 0'/%3E%3C/filter%3E%3Crect width='420' height='300' fill='%23fff' filter='url(%23paper)' opacity='.74'/%3E%3C/svg%3E"),
    linear-gradient(135deg, #005660 0%, #007475 18%, #008081 36%, #229389 56%, #34a798 76%, #57c3ad 100%);
  background-size: auto, 420px 300px, auto;
  background-blend-mode: normal, soft-light, normal;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1rem;
  min-height: 100vh;
  overflow-x: hidden;
}

.sidebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid rgba(215, 222, 234, 0.75);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 251, 255, 0.92)),
    linear-gradient(135deg, rgba(66, 87, 255, 0.08), rgba(255, 107, 95, 0.08));
  box-shadow: 0 12px 42px rgba(31, 37, 68, 0.07);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.logo-mark {
  width: 3.2rem;
  height: 3.2rem;
  flex: 0 0 auto;
  filter: drop-shadow(0 12px 22px rgba(0, 86, 96, 0.28));
}

.brand h1,
.brand p,
.topbar p,
h2,
.feedback {
  margin: 0;
}

.brand h1 {
  font-size: 1.08rem;
  line-height: 1.1;
}

.brand p {
  color: var(--muted);
  font-size: 0.82rem;
}

.app-options {
  position: relative;
  margin-left: auto;
}

.app-options-menu {
  top: calc(100% + 0.55rem);
  right: 0;
  bottom: auto;
  left: auto;
  z-index: 30;
  display: grid;
  gap: 0.5rem;
  width: min(20rem, calc(100vw - 2rem));
}

[dir="rtl"] .app-options {
  margin-right: auto;
  margin-left: 0;
}

[dir="rtl"] .app-options-menu {
  right: auto;
  left: 0;
}

.language-picker {
  display: grid;
  gap: 0.35rem;
  min-width: 12rem;
}

.language-picker span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.language-picker select {
  width: 100%;
  min-height: 2.35rem;
  padding: 0 0.75rem;
  border: 1px solid rgba(215, 222, 234, 0.85);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.settings-language-picker {
  min-width: 0;
  padding: 0.35rem 0.55rem 0.55rem;
  border-bottom: 1px solid rgba(215, 222, 234, 0.75);
}

.primary-action,
.secondary-button,
.confidence,
.mode-tab,
.sidebar-tab,
.set-button,
.icon-button,
.voice-button,
.options-menu-button,
.choice-button,
.create-choice,
.kim-card,
.side-option {
  border: 0;
  border-radius: 0.45rem;
  transition:
    transform 150ms ease,
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0 1rem;
  background: linear-gradient(135deg, var(--blue), #694dff);
  color: white;
  font-weight: 750;
  box-shadow: 0 12px 24px rgba(66, 87, 255, 0.2);
}

.primary-action:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.primary-action.compact {
  min-height: 2.4rem;
}

.secondary-button.compact {
  min-height: 2.4rem;
  padding: 0 1rem;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid rgba(215, 222, 234, 0.75);
  border-radius: 0.65rem;
  background: rgba(232, 238, 247, 0.72);
}

.sidebar-tab {
  min-height: 2.2rem;
  padding: 0 0.5rem;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.sidebar-tab.active {
  background: #ffffff;
  color: #005660;
  box-shadow: 0 8px 18px rgba(0, 86, 96, 0.12);
}

.set-list {
  display: grid;
  gap: 0.55rem;
  overflow: auto;
  padding-right: 0.15rem;
  scrollbar-width: none;
}

.set-list::-webkit-scrollbar {
  display: none;
}

.set-button {
  display: grid;
  gap: 0.25rem;
  width: 100%;
  padding: 0.72rem;
  border: 1px solid rgba(215, 222, 234, 0.65);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  text-align: left;
}

.set-button:hover,
.set-button.active {
  border-color: rgba(66, 87, 255, 0.3);
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(31, 37, 68, 0.08);
}

.set-button.active {
  border-left: 0.28rem solid var(--blue);
}

.set-button.compact {
  padding: 0.62rem;
  background: rgba(255, 255, 255, 0.78);
}

.set-name {
  overflow: visible;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}

.set-meta,
.eyebrow,
.editor-row label span,
.folder-picker span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.workspace {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.95rem;
  min-width: 0;
  width: min(100%, 78rem);
  margin: 0 auto;
  padding: 1.2rem;
  overflow: hidden;
}

.workspace.is-overview {
  grid-template-rows: minmax(0, 1fr);
}

.workspace.is-overview .topbar,
.workspace.is-overview .mode-tabs {
  display: none;
}

.home-screen,
.library-screen,
.collection-screen,
.shop-screen,
.info-screen {
  width: min(100%, 78rem);
  margin: 0 auto;
  padding: 1.2rem 1.2rem 6.5rem;
  overflow-x: clip;
}

.screen-header {
  margin-bottom: 1rem;
}

.screen-header .eyebrow,
.screen-header h2 {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 42, 48, 0.35);
}

.screen-header h2 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.75rem, 4vw, 2.6rem);
}

.screen-meta {
  margin: 0.35rem 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.9rem;
  font-weight: 850;
  text-shadow: 0 1px 2px rgba(0, 42, 48, 0.35);
}

.info-panel {
  min-height: min(28rem, 52vh);
  border: 1px solid rgba(215, 222, 234, 0.78);
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 38px rgba(0, 42, 48, 0.14);
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.85rem;
}

.home-set-card {
  display: grid;
  gap: 0.45rem;
  min-height: 8.5rem;
  padding: 1rem;
  border: 1px solid rgba(215, 222, 234, 0.75);
  border-radius: 0.85rem;
  background:
    radial-gradient(circle at 16% 14%, rgba(255, 255, 255, 0.88), transparent 8rem),
    linear-gradient(145deg, #effff9, #fff4d7);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 16px 32px rgba(31, 37, 68, 0.12);
}

.home-set-card:hover {
  border-color: rgba(0, 128, 129, 0.38);
  transform: translateY(-2px);
}

.home-set-card strong {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.home-set-card span {
  color: var(--muted);
  font-weight: 700;
}

.home-card-action {
  align-self: end;
  color: #005660 !important;
  font-size: 0.86rem;
  text-transform: uppercase;
}

.home-quote {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 0.85rem;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.22), transparent 10rem),
    rgba(0, 54, 60, 0.28);
  box-shadow: 0 16px 32px rgba(0, 42, 48, 0.16);
}

.home-quote p {
  margin: 0;
  color: rgba(255, 255, 255, 0.94);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 850;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0, 42, 48, 0.32);
}

.home-rare-gallery {
  max-width: 100%;
  margin-top: 1.25rem;
  padding: 1rem;
  overflow: hidden;
  border: 1px solid rgba(215, 222, 234, 0.5);
  border-radius: 0.85rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08)),
    rgba(0, 54, 60, 0.26);
  box-shadow: 0 18px 36px rgba(0, 42, 48, 0.18);
}

.home-gallery-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.home-gallery-header .eyebrow {
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 1px 2px rgba(0, 42, 48, 0.35);
}

.home-gallery-header span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: right;
}

.home-gallery-track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.6rem, 1fr));
  gap: 0.85rem;
  width: 100%;
  min-width: 0;
}

.home-rare-card {
  display: grid;
  gap: 0.42rem;
  padding: 0.62rem;
  border: 1px solid rgba(238, 242, 247, 0.54);
  border-radius: 0.75rem;
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.92), rgba(148, 163, 184, 0.74));
  color: #1f2937;
  box-shadow: 0 12px 24px rgba(0, 42, 48, 0.18);
  animation: home-gallery-pulse 9s ease-in-out infinite;
  animation-delay: calc(var(--gallery-order, 0) * -0.7s);
}

.home-rare-image-frame {
  position: relative;
  display: grid;
  min-height: 6.8rem;
  overflow: hidden;
  border-radius: 0.58rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5), transparent),
    #94a3b8;
  place-items: center;
}

.home-rare-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) saturate(0.2) brightness(0.82);
  opacity: 0.72;
}

.home-rare-card strong {
  overflow-wrap: anywhere;
  font-size: 0.74rem;
  line-height: 1.15;
}

.home-rare-card span:not(.collectable-fallback) {
  color: #334155;
  font-size: 0.68rem;
  font-weight: 850;
}

[dir="rtl"] .home-gallery-header span {
  text-align: left;
}

@keyframes home-gallery-pulse {
  0%,
  100% {
    transform: translateY(0);
    box-shadow: 0 12px 24px rgba(0, 42, 48, 0.18);
  }
  45% {
    transform: translateY(-0.22rem);
    box-shadow: 0 18px 32px rgba(0, 42, 48, 0.26);
  }
}

.collection-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: -0.35rem 0 1rem;
}

.collection-tab {
  min-height: 2.55rem;
  padding: 0 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  background: rgba(0, 42, 48, 0.22);
  color: rgba(247, 255, 250, 0.86);
  font-size: 0.86rem;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.collection-tab.active,
.collection-tab:hover {
  border-color: rgba(255, 238, 176, 0.72);
  background: linear-gradient(135deg, #fff4ad, #dffff1);
  color: #123239;
  transform: translateY(-1px);
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.4rem, 1fr));
  gap: 0.85rem;
  padding-bottom: 5rem;
}

.collectable-card {
  position: relative;
  display: grid;
  gap: 0.65rem;
  align-content: start;
  min-height: 16rem;
  padding: 0.72rem;
  border: 1px solid rgba(215, 222, 234, 0.78);
  border-radius: 0.85rem;
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 255, 255, 0.9), transparent 5.8rem),
    linear-gradient(145deg, #fff7db, #dffff1 62%, #d8f3ff);
  color: var(--ink);
  box-shadow: 0 16px 34px rgba(0, 42, 48, 0.16);
  overflow: hidden;
}

.collectable-card::after {
  content: "";
  position: absolute;
  inset: auto -1.8rem -2.2rem auto;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: rgba(255, 204, 77, 0.42);
}

.collectable-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 2;
  padding: 0.2rem 0.42rem;
  border-radius: 999px;
  background: rgba(0, 86, 96, 0.9);
  color: white;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.collectable-image-frame {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 2.5 / 3.5;
  border-radius: 0.68rem;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.88), transparent 5.4rem),
    linear-gradient(135deg, rgba(0, 86, 96, 0.1), rgba(87, 195, 173, 0.2));
  overflow: hidden;
}

.collectable-image-frame img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.collectable-fallback {
  position: absolute;
  z-index: 1;
  color: rgba(0, 86, 96, 0.28);
  font-size: 3rem;
  font-weight: 950;
}

.collectable-count-badge {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 1.55rem;
  height: 1.55rem;
  padding: 0 0.28rem;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  background: linear-gradient(145deg, #005660, #008081);
  color: white;
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 8px 16px rgba(0, 42, 48, 0.25);
}

.collectable-count-badge::before {
  content: "x";
  margin-right: 0.04rem;
  font-size: 0.58rem;
  opacity: 0.82;
}

.collectable-card strong {
  position: relative;
  z-index: 1;
  min-height: 2.5rem;
  color: #123239;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.collectable-rarity {
  position: relative;
  z-index: 1;
  width: fit-content;
  padding: 0.24rem 0.45rem;
  border-radius: 999px;
  background: rgba(0, 86, 96, 0.1);
  color: #005660;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
}

.collectable-card.image-missing .collectable-image-frame {
  background: linear-gradient(145deg, #f7f9fc, #dffff1);
}

.collectable-card.is-locked {
  border-color: rgba(148, 163, 184, 0.34);
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 255, 255, 0.6), transparent 5.8rem),
    linear-gradient(145deg, #e7ebf0, #cbd5df);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.collectable-card.is-locked::after {
  background: rgba(100, 116, 139, 0.22);
}

.collectable-card.is-locked .collectable-badge {
  background: rgba(71, 85, 105, 0.88);
}

.collectable-card.is-locked .collectable-image-frame {
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.65), transparent 4rem),
    linear-gradient(145deg, #d1d8e0, #98a6b5);
}

.collectable-card.is-locked .collectable-image-frame img {
  filter: grayscale(1) brightness(0.7) contrast(0.88);
  opacity: 0.72;
}

.collectable-card.is-locked .collectable-fallback {
  color: rgba(51, 65, 85, 0.16);
  font-size: clamp(3.5rem, 10vw, 5rem);
}

.collectable-card.is-locked strong {
  color: #334155;
  letter-spacing: 0;
}

.collectable-card.is-locked .collectable-rarity {
  background: rgba(71, 85, 105, 0.16);
  color: #475569;
}

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
  padding-bottom: 5rem;
}

.shop-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.shop-wallet-controls {
  display: grid;
  justify-items: end;
  gap: 0.55rem;
}

.wallet-pill {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  min-height: 2.7rem;
  padding: 0.35rem 0.75rem 0.35rem 0.45rem;
  border: 1px solid rgba(255, 230, 150, 0.62);
  border-radius: 999px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 244, 204, 0.82)),
    linear-gradient(145deg, #fff7d1, #dffff1);
  color: #51340a;
  font-size: 1rem;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(0, 42, 48, 0.16);
}

.wallet-pill.is-unlimited {
  border-color: rgba(255, 214, 102, 0.92);
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.96), transparent 3.8rem),
    linear-gradient(145deg, #fff4ad, #cfffe9 62%, #bff3ff);
  box-shadow:
    0 14px 30px rgba(0, 42, 48, 0.18),
    0 0 0 4px rgba(255, 224, 120, 0.2);
}

.unlimited-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.35rem;
  padding: 0.35rem 0.65rem 0.35rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(0, 42, 48, 0.24);
  color: #f7fffa;
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  cursor: pointer;
}

.unlimited-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  flex: 0 0 auto;
  width: 2.65rem;
  height: 1.4rem;
  border-radius: 999px;
  background: rgba(0, 42, 48, 0.48);
  box-shadow: inset 0 1px 3px rgba(0, 22, 26, 0.35);
  transition: background 160ms ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 0.18rem;
  left: 0.2rem;
  width: 1.04rem;
  height: 1.04rem;
  border-radius: 50%;
  background: #f7fffa;
  box-shadow: 0 2px 7px rgba(0, 22, 26, 0.28);
  transition: transform 160ms ease, background 160ms ease;
}

.unlimited-toggle input:checked + .toggle-track {
  background: linear-gradient(135deg, #ffd65c, #57c3ad);
}

.unlimited-toggle input:checked + .toggle-track::after {
  background: #fff7d1;
  transform: translateX(1.22rem);
}

.unlimited-toggle input:focus-visible + .toggle-track {
  outline: 3px solid rgba(255, 255, 255, 0.72);
  outline-offset: 3px;
}

.coin-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1.85rem;
  height: 1.85rem;
  border: 2px solid #b87409;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, #fff5ba 0 18%, transparent 19%),
    radial-gradient(circle at 68% 72%, rgba(132, 78, 0, 0.28) 0 18%, transparent 19%),
    linear-gradient(145deg, #ffe889, #f2a916 55%, #c47c08);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.68),
    inset 0 -3px 4px rgba(94, 52, 0, 0.32),
    0 4px 8px rgba(94, 52, 0, 0.22);
}

.coin-icon::before {
  content: "M";
  display: grid;
  place-items: center;
  width: 1.08rem;
  height: 1.08rem;
  border: 1px solid rgba(125, 72, 0, 0.38);
  border-radius: 50%;
  background: rgba(255, 246, 191, 0.45);
  color: #7a4700;
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.pack-card {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 0.9rem;
  align-items: stretch;
  min-height: 11.5rem;
  padding: 0.9rem;
  border: 1px solid rgba(215, 222, 234, 0.78);
  border-radius: 0.95rem;
  background:
    radial-gradient(circle at 14% 14%, rgba(255, 255, 255, 0.92), transparent 7rem),
    linear-gradient(145deg, #fff2be, #e1fff4 58%, #d7f0ff);
  box-shadow: 0 18px 38px rgba(0, 42, 48, 0.18);
}

.pack-art {
  position: relative;
  min-height: 9.4rem;
  border-radius: 0.8rem;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.7), transparent 4.4rem),
    linear-gradient(145deg, #005660, #008081 52%, #57c3ad);
  color: white;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  overflow: hidden;
}

.pack-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 242, 190, 0.72), transparent 3.2rem),
    radial-gradient(circle at 22% 84%, rgba(0, 42, 48, 0.28), transparent 4.2rem);
}

.pack-character {
  position: absolute;
  z-index: 1;
  width: 3.4rem;
  height: 4.8rem;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 0.42rem;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 22px rgba(0, 42, 48, 0.25);
  object-fit: contain;
}

.pack-character-1 {
  left: 0.75rem;
  top: 0.8rem;
  transform: rotate(-8deg);
}

.pack-character-2 {
  right: 0.75rem;
  top: 1.35rem;
  transform: rotate(7deg);
}

.pack-character-3 {
  left: 50%;
  bottom: 0.8rem;
  transform: translateX(-50%) rotate(2deg);
}

.pack-character-4 {
  left: 0.5rem;
  bottom: 0.55rem;
  width: 2.9rem;
  height: 4.1rem;
  transform: rotate(9deg);
}

.pack-character-5 {
  right: 0.45rem;
  bottom: 0.5rem;
  width: 2.9rem;
  height: 4.1rem;
  transform: rotate(-10deg);
}

.pack-body {
  display: grid;
  gap: 0.55rem;
  align-content: space-between;
  min-width: 0;
}

.pack-body h3 {
  margin: 0;
  color: #123239;
  font-size: 1.2rem;
  line-height: 1.1;
}

.pack-body p {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.35;
}

.pack-footer {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.pack-probability-control {
  position: relative;
}

.pack-options-button {
  display: inline-grid;
  grid-template-columns: repeat(3, 0.22rem);
  gap: 0.18rem;
  width: 2.35rem;
  height: 2.35rem;
  place-content: center;
  border: 1px solid rgba(0, 86, 96, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  color: #005660;
  box-shadow: 0 10px 20px rgba(0, 42, 48, 0.12);
}

.pack-options-button span {
  width: 0.22rem;
  height: 0.22rem;
  border-radius: 50%;
  background: currentColor;
}

.pack-options-button:hover,
.pack-options-button[aria-expanded="true"] {
  background: #005660;
  color: #fff;
}

.pack-probability-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.5rem);
  z-index: 8;
  display: grid;
  gap: 0.55rem;
  width: min(19rem, calc(100vw - 2.5rem));
  padding: 0.55rem;
  border: 1px solid rgba(0, 86, 96, 0.18);
  border-radius: 0.8rem;
  background: #ffffff;
  color: #123239;
  box-shadow: 0 18px 36px rgba(0, 42, 48, 0.22);
}

.pack-probability-menu::after {
  content: "";
  position: absolute;
  right: 0.82rem;
  bottom: -0.42rem;
  width: 0.75rem;
  height: 0.75rem;
  border-right: 1px solid rgba(0, 86, 96, 0.18);
  border-bottom: 1px solid rgba(0, 86, 96, 0.18);
  background: #ffffff;
  transform: rotate(45deg);
}

.pack-probability-action {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 2.25rem;
  padding: 0 0.65rem;
  border: 0;
  border-radius: 0.55rem;
  background: #f0fbf8;
  color: #005660;
  text-align: left;
  font-weight: 900;
}

.pack-probability-action:hover {
  background: #dbf4ef;
}

.pack-probability-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem;
  border-radius: 0.65rem;
  background: #f7fbfa;
  color: #123239;
}

.pack-probability-menu:not(.is-showing-odds) .pack-probability-panel {
  display: none;
}

.pack-probability-panel strong {
  font-size: 0.78rem;
  text-transform: uppercase;
  color: #005660;
}

.pack-probability-panel dl {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.pack-probability-panel dt {
  margin: 0;
  color: #123239;
  font-size: 0.82rem;
  font-weight: 950;
}

.pack-probability-panel dd {
  margin: -0.3rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  line-height: 1.35;
}

[dir="rtl"] .pack-probability-menu {
  right: auto;
  left: 0;
}

[dir="rtl"] .pack-probability-menu::after {
  right: auto;
  left: 0.82rem;
}

[dir="rtl"] .pack-probability-action {
  text-align: right;
}

.pack-price {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  min-height: 2.35rem;
  padding: 0.25rem 0.85rem 0.25rem 0.35rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #005660, #008081);
  color: white;
  font-weight: 950;
  box-shadow: 0 10px 22px rgba(0, 86, 96, 0.22);
}

.pack-price .coin-icon {
  width: 1.55rem;
  height: 1.55rem;
  border-width: 1px;
}

.pack-price .coin-icon::before {
  width: 0.9rem;
  height: 0.9rem;
  font-size: 0.56rem;
}

.pack-result {
  margin: 0.15rem 0 5rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(215, 222, 234, 0.78);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.88);
  color: #123239;
  font-weight: 800;
  line-height: 1.45;
  box-shadow: 0 14px 28px rgba(0, 42, 48, 0.12);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0.85rem;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, minmax(4.3rem, 1fr));
  gap: 0.3rem;
  width: min(38rem, calc(100vw - 1.4rem));
  padding: 0.35rem;
  border: 1px solid rgba(215, 222, 234, 0.75);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 44px rgba(0, 42, 48, 0.22);
  backdrop-filter: blur(16px);
  transform: translateX(-50%);
}

.bottom-nav-button {
  display: grid;
  place-items: center;
  gap: 0.15rem;
  min-height: 3.1rem;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.bottom-nav-button > span:first-child {
  font-size: 1.1rem;
  line-height: 1;
}

.bottom-nav-button.active,
.bottom-nav-button:hover {
  background: linear-gradient(135deg, #005660, #008081);
  color: white;
}

.create-nav-button {
  background: linear-gradient(135deg, var(--blue), #694dff);
  color: white;
  box-shadow: 0 10px 20px rgba(66, 87, 255, 0.2);
}

.bottom-nav-button.is-idle {
  animation: navNudge 330ms ease;
}

.set-entry {
  display: grid;
  gap: 1rem;
}

.set-entry-hero,
.entry-progress,
.set-card-preview {
  border: 1px solid rgba(215, 222, 234, 0.76);
  border-radius: 1rem;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.84), transparent 11rem),
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(239, 255, 249, 0.9));
  box-shadow: 0 16px 36px rgba(31, 37, 68, 0.1);
}

.set-entry-hero {
  position: relative;
  display: grid;
  gap: 0.65rem;
  min-height: 10rem;
  align-content: center;
  padding: 1.1rem 4.2rem 1.1rem 1.1rem;
}

[dir="rtl"] .set-entry-hero {
  padding-right: 1.1rem;
  padding-left: 4.2rem;
}

.set-entry-hero h2 {
  margin: 0.2rem 0 0;
  color: var(--ink);
  font-size: clamp(1.7rem, 4vw, 2.8rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.set-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.set-entry-meta span {
  padding: 0.4rem 0.58rem;
  border-radius: 999px;
  background: rgba(0, 86, 96, 0.08);
  color: #005660;
  font-size: 0.84rem;
  font-weight: 800;
}

.set-menu-button {
  top: 1rem;
  right: 1rem;
  bottom: auto;
}

[dir="rtl"] .set-menu-button {
  right: auto;
  left: 1rem;
}

.options-menu.set-options-menu {
  top: 3.75rem;
  right: 1rem;
  bottom: auto;
  display: grid;
  gap: 0.35rem;
  width: min(15rem, calc(100% - 2rem));
  padding: 0.55rem;
  border: 1px solid rgba(0, 86, 96, 0.28);
  border-radius: 0.8rem;
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.9),
    0 22px 48px rgba(0, 42, 48, 0.32);
}

[dir="rtl"] .options-menu.set-options-menu {
  right: auto;
  left: 1rem;
}

.options-menu.set-options-menu::before {
  content: "";
  position: absolute;
  top: -0.38rem;
  right: 0.85rem;
  width: 0.75rem;
  height: 0.75rem;
  border-left: 1px solid rgba(0, 86, 96, 0.28);
  border-top: 1px solid rgba(0, 86, 96, 0.28);
  background: #ffffff;
  transform: rotate(45deg);
}

[dir="rtl"] .options-menu.set-options-menu::before {
  right: auto;
  left: 0.85rem;
}

.menu-title {
  margin: 0;
  padding: 0.35rem 0.55rem 0.2rem;
  color: #005660;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.menu-action {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 2.55rem;
  padding: 0 0.7rem;
  border: 0;
  border-radius: 0.62rem;
  background: #f6faf9;
  color: var(--ink);
  text-align: left;
  font-weight: 800;
}

.menu-action::before {
  display: grid;
  width: 1.45rem;
  height: 1.45rem;
  place-items: center;
  border-radius: 0.45rem;
  background: rgba(0, 86, 96, 0.08);
  color: #005660;
  font-size: 0.9rem;
}

.edit-action::before {
  content: "E";
}

.reset-action::before {
  content: "R";
  background: rgba(111, 70, 229, 0.12);
  color: #5b35d5;
}

.faq-action::before {
  content: "?";
}

.privacy-action::before {
  content: "P";
}

.save-action::before {
  content: "S";
  background: rgba(0, 128, 129, 0.12);
  color: #007475;
}

.delete-action {
  border-top: 1px solid rgba(215, 222, 234, 0.75);
  margin-top: 0.15rem;
  background: #fff7f6;
}

.delete-action::before {
  content: "!";
  background: rgba(217, 45, 32, 0.1);
  color: var(--red);
}

.menu-action:hover {
  background: rgba(0, 86, 96, 0.07);
  transform: none;
}

.danger-text {
  color: var(--red);
}

.entry-progress {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem;
}

.entry-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.entry-progress-header span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
  text-transform: uppercase;
}

.entry-progress-header strong {
  color: #005660;
}

.progress-track.compact {
  height: 0.32rem;
}

.study-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.study-mode-card {
  display: grid;
  min-height: 5rem;
  padding: 0.9rem;
  place-items: center;
  border: 1px solid rgba(139, 92, 246, 0.48);
  border-radius: 0.85rem;
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.26), transparent 6.5rem),
    linear-gradient(145deg, #5b21b6 0%, #7c3aed 56%, #9f67ff 100%);
  color: #fff;
  text-align: center;
  box-shadow: 0 16px 30px rgba(91, 33, 182, 0.22);
}

.study-mode-card:hover {
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 20px 36px rgba(91, 33, 182, 0.3);
  transform: translateY(-2px);
}

.study-mode-card strong {
  font-size: 1.05rem;
}

.set-card-preview {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
}

.preview-card-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.preview-card {
  display: grid;
  gap: 0.25rem;
  min-height: 4.5rem;
  padding: 0.7rem;
  border: 1px solid rgba(215, 222, 234, 0.8);
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 20px rgba(31, 37, 68, 0.06);
  overflow: hidden;
}

.preview-card strong,
.preview-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-card strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.preview-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.topbar,
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

.topbar .eyebrow,
.editor-header .eyebrow,
.editor-header h2 {
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 2px rgba(0, 42, 48, 0.35);
}

.set-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.overview-column {
  position: relative;
  display: grid;
  gap: 0.65rem;
  min-height: 8.5rem;
  padding: 0.85rem;
  border: 2px solid rgba(215, 222, 234, 0.72);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 28px rgba(31, 37, 68, 0.1);
  overflow: hidden;
}

.overview-column::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 0.42rem;
}

.overview-column.unknown {
  border-color: rgba(217, 45, 32, 0.76);
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.9), transparent 7rem),
    linear-gradient(145deg, #ffd8d2 0%, #fff4f2 100%);
  box-shadow: 0 16px 32px rgba(217, 45, 32, 0.18);
}

.overview-column.unknown::before {
  background: linear-gradient(90deg, #b42318, #ff4d3d);
}

.overview-column.learning {
  border-color: rgba(243, 178, 60, 0.88);
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.9), transparent 7rem),
    linear-gradient(145deg, #ffe7a6 0%, #fff8e4 100%);
  box-shadow: 0 16px 32px rgba(183, 121, 31, 0.18);
}

.overview-column.learning::before {
  background: linear-gradient(90deg, #b7791f, #f3b23c);
}

.overview-column.mastered {
  border-color: rgba(7, 134, 105, 0.78);
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.9), transparent 7rem),
    linear-gradient(145deg, #c9fce9 0%, #f1fff9 100%);
  box-shadow: 0 16px 32px rgba(7, 134, 105, 0.18);
}

.overview-column.mastered::before {
  background: linear-gradient(90deg, #047857, #18d47b);
}

.overview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.overview-heading span {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 950;
  text-transform: uppercase;
}

.overview-heading strong {
  display: grid;
  min-width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-size: 1rem;
  box-shadow: 0 10px 18px rgba(31, 37, 68, 0.16);
}

.overview-column.unknown .overview-heading span {
  color: #9f0712;
}

.overview-column.learning .overview-heading span {
  color: #7a4700;
}

.overview-column.mastered .overview-heading span {
  color: #005f3e;
}

.overview-column.unknown .overview-heading strong {
  background: var(--red);
}

.overview-column.learning .overview-heading strong {
  background: var(--gold);
  color: #3b2a03;
}

.overview-column.mastered .overview-heading strong {
  background: var(--green);
}

.overview-card-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-content: start;
}

.overview-card-chip,
.overview-empty {
  max-width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 750;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-empty {
  color: var(--muted);
}

[dir="rtl"] .topbar {
  direction: rtl;
}

.title-input {
  width: min(42rem, 100%);
  margin-top: 0.2rem;
  border: 0;
  background: transparent;
  color: #ffffff;
  font-size: clamp(1.45rem, 3vw, 2.3rem);
  font-weight: 850;
  outline: none;
  text-shadow: 0 2px 4px rgba(0, 42, 48, 0.34);
}

.topbar-actions,
.control-row,
.confidence-row,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar-actions {
  align-items: end;
  direction: ltr;
  margin-inline-start: auto;
}

[dir="rtl"] .topbar-actions .folder-picker {
  direction: rtl;
}

.topbar-menu {
  position: relative;
  display: grid;
  align-self: end;
}

.topbar-options-button {
  position: static;
}

.topbar-options-menu {
  top: calc(100% + 0.5rem);
  right: 0;
  bottom: auto;
  display: grid;
  gap: 0.5rem;
  width: min(18rem, calc(100vw - 2rem));
  padding: 0.65rem;
  border: 1px solid rgba(0, 86, 96, 0.28);
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.92),
    0 18px 38px rgba(0, 42, 48, 0.28);
}

[dir="rtl"] .topbar-options-menu {
  right: 0;
  left: auto;
}

.folder-picker {
  display: grid;
  gap: 0.25rem;
}

.menu-folder-picker {
  padding: 0.55rem;
  border: 1px solid rgba(0, 86, 96, 0.12);
  border-radius: 0.65rem;
  background: #f6faf9;
}

.folder-picker select {
  min-height: 2.3rem;
  width: 100%;
  max-width: 12rem;
  padding: 0 0.6rem;
  border: 1px solid rgba(215, 222, 234, 0.85);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-weight: 750;
}

.menu-folder-picker select {
  max-width: none;
  background: #ffffff;
}

.topbar .folder-picker span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.icon-button,
.voice-button {
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

.icon-button:hover,
.voice-button:hover {
  transform: translateY(-1px);
}

.voice-button {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 3;
  border-color: rgba(0, 86, 96, 0.2);
  color: #005660;
  box-shadow: 0 10px 20px rgba(0, 86, 96, 0.12);
}

[dir="rtl"] .voice-button {
  right: 1rem;
  left: auto;
}

.voice-button.is-speaking {
  background: #005660;
  color: white;
}

.icon-button svg,
.voice-button svg {
  width: 1.12rem;
  height: 1.12rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.danger {
  color: var(--red);
}

.mode-tabs {
  display: flex;
  width: fit-content;
  max-width: 100%;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 0.25rem;
  border: 1px solid rgba(215, 222, 234, 0.75);
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 30px rgba(31, 37, 68, 0.08);
}

.mode-tab {
  min-width: 5rem;
  min-height: 2.35rem;
  padding: 0 0.9rem;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.overview-return-tab {
  background: rgba(0, 86, 96, 0.08);
  color: #005660;
}

.overview-return-tab:hover {
  background: rgba(0, 86, 96, 0.14);
  transform: translateY(-1px);
}

.overview-return-tab:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.mode-tab.active {
  background: linear-gradient(135deg, var(--ink), #30354d);
  color: white;
  box-shadow: 0 8px 18px rgba(23, 24, 28, 0.18);
}

.mode-panel {
  display: none;
  min-height: 0;
}

.mode-panel.active {
  display: block;
}

.hidden {
  display: none !important;
}

.study-layout {
  display: grid;
  grid-template-columns: minmax(24rem, 1fr) minmax(15rem, 20rem);
  gap: 1.2rem;
  height: 100%;
  min-height: 27rem;
}

.flashcard-scene {
  position: relative;
  display: grid;
  min-height: 24rem;
  perspective: 1400px;
}

.flashcard {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 24rem;
  padding: clamp(1.2rem, 4vw, 3rem);
  border: 1px solid transparent;
  border-radius: 1rem;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.82), transparent 12rem) padding-box,
    linear-gradient(145deg, #d9fff0 0%, #e8fff8 48%, #fff3d6 100%) padding-box,
    linear-gradient(135deg, rgba(0, 86, 96, 0.85), rgba(87, 195, 173, 0.68), rgba(255, 184, 89, 0.8)) border-box;
  box-shadow: var(--shadow);
  color: var(--ink);
  text-align: center;
  overflow: hidden;
  transform-origin: center;
  transform-style: preserve-3d;
  touch-action: pan-y;
  user-select: none;
  will-change: transform, opacity;
}

.flashcard.is-swiping {
  cursor: grabbing;
  transition: none;
  transform: translateX(var(--swipe-x, 0)) rotate(var(--swipe-rotate, 0));
}

.flashcard.is-swipe-known {
  border-color: rgba(3, 126, 74, 0.78);
  box-shadow:
    0 24px 44px rgba(3, 126, 74, 0.24),
    0 0 0 5px rgba(25, 214, 111, 0.24);
}

.flashcard.is-swipe-unknown {
  border-color: rgba(159, 7, 18, 0.76);
  box-shadow:
    0 24px 44px rgba(159, 7, 18, 0.24),
    0 0 0 5px rgba(255, 59, 59, 0.22);
}

.flashcard.is-swipe-known::after {
  height: 0.72rem;
  background: linear-gradient(90deg, #007a3d, #19d66f);
}

.flashcard.is-swipe-unknown::after {
  height: 0.72rem;
  background: linear-gradient(90deg, #9f0712, #ff3b3b);
}

.flashcard.is-flipped {
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.78), transparent 12rem) padding-box,
    linear-gradient(145deg, #e5fff6 0%, #d7fbff 48%, #fff0e8 100%) padding-box,
    linear-gradient(135deg, rgba(0, 116, 117, 0.85), rgba(52, 167, 152, 0.68), rgba(255, 107, 95, 0.72)) border-box;
}

.flashcard.is-advancing {
  animation: cardAdvance 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.flashcard.is-returning {
  animation: cardReturn 560ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.flashcard.is-complete {
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.92), transparent 11rem) padding-box,
    linear-gradient(145deg, #fff4cb 0%, #d9fff0 46%, #ddf0ff 100%) padding-box,
    linear-gradient(135deg, rgba(243, 178, 60, 0.9), rgba(87, 195, 173, 0.88), rgba(66, 87, 255, 0.74)) border-box;
}

.flashcard.is-completing {
  animation: stackComplete 780ms cubic-bezier(0.18, 0.9, 0.2, 1);
}

.flashcard.is-flip-out {
  animation: cardFlipOut 160ms cubic-bezier(0.4, 0, 0.7, 0.2) forwards;
}

.flashcard.is-flip-in {
  animation: cardFlipIn 180ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.flashcard::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 86, 96, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(0, 128, 129, 0.07) 1px, transparent 1px);
  background-size: 2.1rem 2.1rem;
  mask-image: linear-gradient(135deg, black, transparent 72%);
}

.flashcard::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.42rem;
  background: linear-gradient(90deg, var(--blue), var(--cyan), var(--coral), var(--gold));
}

.flip-hint,
.card-face-label {
  position: absolute;
  top: 1rem;
  color: #3f6470;
  font-size: 0.8rem;
  font-weight: 800;
}

.flip-hint {
  left: 1rem;
}

.card-face-label {
  display: none;
}

.card-text {
  max-width: 48rem;
  overflow-wrap: anywhere;
  font-size: clamp(1.65rem, 4vw, 3.2rem);
  font-weight: 850;
  line-height: 1.12;
  z-index: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
}

.card-media-frame {
  z-index: 1;
  display: block;
  width: min(9rem, 42%);
  max-width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 7rem;
  overflow: hidden;
  border-radius: 0.85rem;
  box-shadow: 0 12px 22px rgba(0, 86, 96, 0.14);
}

.card-media-frame img,
.learn-image,
.image-preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.flashcard:has(.card-media-frame:not(.hidden)) {
  align-content: center;
  gap: 0.75rem;
}

.flashcard:has(.card-media-frame:not(.hidden)) .card-text {
  max-width: 42rem;
}

.learn-image {
  width: min(18rem, 100%);
  max-height: 12rem;
  margin-top: 0.65rem;
  border-radius: 0.85rem;
  box-shadow: 0 14px 28px rgba(0, 86, 96, 0.14);
}

.restart-on-card {
  position: absolute;
  left: 50%;
  bottom: 1.15rem;
  z-index: 4;
  min-height: 3rem;
  padding: 0 1.25rem;
  border: 0;
  background: linear-gradient(135deg, var(--blue), #008081 55%, var(--green));
  color: white;
  box-shadow: 0 16px 30px rgba(0, 86, 96, 0.24);
  transform: translateX(-50%);
}

.restart-on-card:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 20px 36px rgba(0, 86, 96, 0.3);
}

.restart-on-card:not(.hidden) {
  animation: restartButtonPop 520ms cubic-bezier(0.18, 0.9, 0.2, 1) 140ms both;
}

.options-menu-button {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  z-index: 6;
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  place-items: center;
  border: 1px solid rgba(0, 86, 96, 0.18);
  background: rgba(255, 255, 255, 0.78);
  color: #005660;
  box-shadow: 0 10px 20px rgba(0, 86, 96, 0.12);
}

.options-menu-button:hover,
.options-menu-button[aria-expanded="true"] {
  background: #ffffff;
  transform: translateY(-1px);
}

.options-menu-button svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.options-menu {
  position: absolute;
  right: 1rem;
  bottom: 3.8rem;
  z-index: 7;
  width: min(17rem, calc(100% - 2rem));
  padding: 0.75rem;
  border: 1px solid rgba(215, 222, 234, 0.85);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 38px rgba(31, 37, 68, 0.18);
}

[dir="rtl"] .options-menu-button,
[dir="rtl"] .options-menu {
  right: auto;
  left: 1rem;
}

.topbar-menu > .topbar-options-menu {
  top: calc(100% + 0.5rem);
  right: 0;
  left: auto;
  bottom: auto;
  z-index: 20;
  width: min(18rem, calc(100vw - 2rem));
  border-color: rgba(0, 86, 96, 0.32);
  background: #ffffff;
  color: var(--ink);
  box-shadow:
    0 0 0 1px #ffffff,
    0 22px 48px rgba(0, 42, 48, 0.34);
}

.app-options > .app-options-button {
  position: static;
}

.app-options > .app-options-menu {
  top: calc(100% + 0.55rem);
  right: 0;
  bottom: auto;
  left: auto;
  z-index: 30;
  width: min(20rem, calc(100vw - 2rem));
}

[dir="rtl"] .app-options > .app-options-menu {
  right: auto;
  left: 0;
}

.topbar-menu > .topbar-options-menu::before {
  content: "";
  position: absolute;
  top: -0.42rem;
  right: 0.72rem;
  width: 0.78rem;
  height: 0.78rem;
  border-left: 1px solid rgba(0, 86, 96, 0.32);
  border-top: 1px solid rgba(0, 86, 96, 0.32);
  background: #ffffff;
  transform: rotate(45deg);
}

[dir="rtl"] .topbar-menu > .topbar-options-menu {
  right: 0;
  left: auto;
}

.topbar-options-menu .menu-title,
.topbar-options-menu .menu-action,
.topbar-options-menu .menu-folder-picker,
.topbar-options-menu .menu-folder-picker select {
  color: var(--ink);
}

.topbar-options-menu .menu-title {
  color: #005660;
}

.topbar-options-menu .menu-action {
  background: #f6faf9;
}

.topbar-options-menu .menu-action:hover {
  background: #eaf4f1;
}

.topbar-options-menu .delete-action {
  background: #fff7f6;
}

.topbar-options-menu .delete-action:hover {
  background: #ffe9e5;
}

.study-controls,
.learn-panel,
.kim-panel {
  display: grid;
  align-content: start;
  gap: 1rem;
  padding: 0.9rem;
  border: 1px solid rgba(215, 222, 234, 0.78);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 255, 0.94)),
    linear-gradient(135deg, rgba(66, 87, 255, 0.08), rgba(243, 178, 60, 0.08));
  box-shadow: 0 16px 36px rgba(31, 37, 68, 0.1);
}

.learn-panel,
.kim-panel {
  position: relative;
}

.learn-prompt-block {
  display: grid;
  gap: 0.7rem;
  min-height: 8.5rem;
  align-content: center;
  padding: 1rem;
  padding-right: 3.4rem;
  border: 1px solid rgba(0, 86, 96, 0.12);
  border-radius: 0.85rem;
  background:
    radial-gradient(circle at 14% 16%, rgba(255, 255, 255, 0.92), transparent 8rem),
    linear-gradient(145deg, rgba(239, 255, 249, 0.92), rgba(255, 244, 215, 0.72));
  overflow: hidden;
}

[dir="rtl"] .learn-prompt-block {
  padding-right: 1rem;
  padding-left: 3.4rem;
}

.kim-panel {
  align-content: stretch;
}

.kim-header,
.kim-setup,
.kim-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.kim-header {
  justify-content: space-between;
  padding-right: 3.2rem;
}

.kim-header h2 {
  margin: 0.25rem 0 0;
}

.kim-timer {
  display: grid;
  min-width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #008081);
  color: white;
  font-size: 1.2rem;
  box-shadow: 0 14px 26px rgba(0, 86, 96, 0.22);
}

.kim-setup {
  flex-wrap: wrap;
}

.kim-setup label {
  display: grid;
  flex: 1 1 12rem;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.kim-setup input {
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-weight: 800;
}

.kim-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.75rem;
  align-content: start;
}

.kim-board.is-shuffling .kim-card {
  animation: kimShuffle 620ms cubic-bezier(0.18, 0.9, 0.2, 1);
}

.kim-card {
  display: grid;
  align-content: center;
  gap: 0.45rem;
  min-height: 8rem;
  padding: 0.85rem;
  border: 1px solid rgba(0, 86, 96, 0.16);
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.88), transparent 8rem),
    linear-gradient(145deg, #effff9, #fff4d7);
  color: var(--ink);
  overflow-wrap: anywhere;
  text-align: left;
  box-shadow: 0 12px 24px rgba(31, 37, 68, 0.08);
}

.kim-card span {
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.2;
}

.kim-card.is-removed {
  border-style: dashed;
  background:
    linear-gradient(135deg, rgba(0, 86, 96, 0.08), rgba(66, 87, 255, 0.08)),
    rgba(255, 255, 255, 0.62);
  color: rgba(0, 86, 96, 0.55);
}

.kim-card.is-selectable {
  cursor: pointer;
}

.kim-card.is-selectable:hover,
.kim-card.is-selected {
  border-color: rgba(66, 87, 255, 0.5);
  transform: translateY(-1px);
}

.kim-card.is-selected {
  box-shadow: 0 0 0 3px rgba(66, 87, 255, 0.18), 0 12px 24px rgba(31, 37, 68, 0.08);
}

.kim-card.is-revealed {
  border-color: rgba(7, 134, 105, 0.45);
  background: linear-gradient(145deg, #e9faf4, #fff4d7);
}

.kim-card.is-correct {
  border-color: #12b76a;
  background: linear-gradient(145deg, #18d47b, #8effc4);
  box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.22), 0 16px 28px rgba(18, 183, 106, 0.24);
}

.kim-card.is-incorrect {
  border-color: #7f1d1d;
  background: linear-gradient(145deg, #7f1d1d, #b42318);
  color: #fff5f5;
  box-shadow: 0 0 0 3px rgba(127, 29, 29, 0.2), 0 16px 28px rgba(127, 29, 29, 0.24);
}

.kim-card.is-correct span,
.kim-card.is-incorrect span {
  color: inherit;
}

.kim-answer-form {
  display: grid;
}

.kim-answer-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.7rem;
}

.kim-answer-fields input {
  min-height: 2.7rem;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  outline: none;
}

.kim-answer-fields input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.study-direction {
  display: grid;
  gap: 0.45rem;
}

.direction-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.direction-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem;
  padding: 0.25rem;
  border: 1px solid rgba(215, 222, 234, 0.78);
  border-radius: 0.65rem;
  background: rgba(232, 238, 247, 0.7);
}

.side-option {
  min-height: 2.3rem;
  padding: 0 0.55rem;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.side-option.active {
  background: #ffffff;
  color: #005660;
  box-shadow: 0 8px 18px rgba(0, 86, 96, 0.12);
}

.side-option:hover {
  transform: translateY(-1px);
}

.progress-block {
  display: grid;
  gap: 0.65rem;
}

.progress-block > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-weight: 700;
  flex-wrap: wrap;
  line-height: 1.25;
}

.progress-block strong {
  color: var(--green);
}

.progress-track {
  height: 0.65rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf4;
  box-shadow: inset 0 1px 2px rgba(31, 37, 68, 0.08);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan), var(--blue));
}

.secondary-button {
  min-height: 2.35rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-weight: 750;
}

.secondary-button:hover {
  border-color: #b7c1d0;
  transform: translateY(-1px);
}

.secondary-button.save-set-button {
  border: 0;
  background: linear-gradient(135deg, #7c3aed, #5b2dd6);
  color: #fff;
  box-shadow: 0 12px 24px rgba(91, 45, 214, 0.24);
}

.secondary-button.save-set-button:hover {
  background: linear-gradient(135deg, #6d28d9, #4f24c8);
  border-color: transparent;
}

.secondary-button.restart-on-card {
  min-height: 3rem;
  padding: 0 1.25rem;
  border: 0;
  background: linear-gradient(135deg, var(--blue), #008081 55%, var(--green));
  color: white;
  box-shadow: 0 16px 30px rgba(0, 86, 96, 0.24);
  transform: translateX(-50%);
}

.secondary-button.restart-on-card:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 20px 36px rgba(0, 86, 96, 0.3);
}

.control-row .secondary-button,
.confidence-row .confidence {
  flex: 1;
}

.confidence {
  min-height: 2.35rem;
  padding: 0 0.7rem;
  background: rgba(255, 255, 255, 0.9);
  font-weight: 800;
}

.confidence.low {
  color: var(--red);
  border: 1px solid rgba(217, 45, 32, 0.28);
  background: linear-gradient(180deg, #fff, rgba(255, 239, 237, 0.8));
}

.confidence.medium {
  color: var(--amber);
  border: 1px solid rgba(183, 121, 31, 0.25);
}

.confidence.high {
  color: var(--green);
  border: 1px solid rgba(7, 134, 105, 0.28);
  background: linear-gradient(180deg, #fff, rgba(233, 250, 244, 0.9));
}

@keyframes cardAdvance {
  0% {
    opacity: 0;
    transform: translateX(2.2rem) rotateZ(2deg) scale(0.97);
  }
  62% {
    opacity: 1;
    transform: translateX(-0.28rem) rotateZ(-0.4deg) scale(1.012);
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotateZ(0) scale(1);
  }
}

@keyframes cardReturn {
  0% {
    transform: translateX(-1.8rem) rotateZ(-2.2deg) scale(0.98);
  }
  55% {
    transform: translateX(0.35rem) rotateZ(0.6deg) scale(1.01);
  }
  100% {
    transform: translateX(0) rotateZ(0) scale(1);
  }
}

@keyframes cardFlipOut {
  0% {
    transform: rotateY(0deg) scale(1);
  }
  100% {
    transform: rotateY(88deg) scale(0.985);
  }
}

@keyframes cardFlipIn {
  0% {
    transform: rotateY(-88deg) scale(0.985);
  }
  100% {
    transform: rotateY(0deg) scale(1);
  }
}

@keyframes stackComplete {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: var(--shadow);
  }
  42% {
    transform: translateY(-0.85rem) scale(1.035);
    box-shadow: 0 30px 70px rgba(0, 86, 96, 0.26);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: var(--shadow);
  }
}

@keyframes restartButtonPop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(0.65rem) scale(0.92);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes kimShuffle {
  0% {
    opacity: 0.25;
    transform: translateY(-0.75rem) rotateZ(-1.5deg) scale(0.96);
  }
  60% {
    opacity: 1;
    transform: translateY(0.2rem) rotateZ(0.4deg) scale(1.015);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateZ(0) scale(1);
  }
}

@keyframes navNudge {
  0%,
  100% {
    transform: translateY(0);
  }
  45% {
    transform: translateY(-0.18rem);
  }
}

.answer-form {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.choice-button {
  position: relative;
  min-height: 4rem;
  padding: 0.8rem 2.35rem 0.8rem 0.8rem;
  border: 1px solid rgba(0, 86, 96, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(236, 255, 249, 0.88)),
    linear-gradient(135deg, rgba(0, 128, 129, 0.08), rgba(66, 87, 255, 0.08));
  color: var(--ink);
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-align: left;
  box-shadow: 0 10px 22px rgba(31, 37, 68, 0.08);
}

.choice-button:hover {
  border-color: rgba(0, 128, 129, 0.36);
  transform: translateY(-1px);
}

.choice-button:disabled {
  opacity: 1;
}

.choice-button.choice-correct {
  border-color: #008f3a;
  background: #17f06b;
  color: #031b0c;
  box-shadow:
    0 0 0 5px rgba(23, 240, 107, 0.28),
    inset 0 0 0 2px rgba(255, 255, 255, 0.52);
}

.choice-button.choice-wrong {
  border-color: #aa000c;
  background: #ff1f35;
  color: #fff;
  text-shadow: 0 1px 1px rgba(70, 0, 8, 0.32);
  box-shadow:
    0 0 0 5px rgba(255, 31, 53, 0.24),
    inset 0 0 0 2px rgba(255, 255, 255, 0.32);
}

.choice-button.choice-selected::after {
  position: absolute;
  top: 50%;
  right: 0.85rem;
  display: grid;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #005f2a;
  content: "✓";
  font-size: 1.05rem;
  line-height: 1;
  place-items: center;
  text-shadow: none;
  transform: translateY(-50%);
}

.choice-button.choice-wrong.choice-selected::after {
  color: #a0000c;
}

[dir="rtl"] .choice-button {
  padding: 0.8rem 0.8rem 0.8rem 2.35rem;
  text-align: right;
}

[dir="rtl"] .choice-button.choice-selected::after {
  right: auto;
  left: 0.85rem;
}

.answer-form input,
.dialog-body textarea,
.editor-row textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  outline: none;
}

.answer-form input {
  min-height: 2.7rem;
  padding: 0 0.85rem;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.answer-form input:focus,
.dialog-body textarea:focus,
.editor-row textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.answer-form input.answer-correct {
  border-color: #007a3d;
  background: #19d66f;
  color: #052413;
  box-shadow:
    0 0 0 5px rgba(0, 122, 61, 0.32),
    inset 0 0 0 2px rgba(255, 255, 255, 0.5);
  transform: scale(1.01);
}

.answer-form input.answer-correct:focus {
  border-color: #005f30;
  box-shadow:
    0 0 0 5px rgba(0, 122, 61, 0.38),
    inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.answer-form input.answer-wrong {
  border-color: #9f0712;
  background: #ff3b3b;
  color: #fff;
  box-shadow:
    0 0 0 5px rgba(159, 7, 18, 0.32),
    inset 0 0 0 2px rgba(255, 255, 255, 0.38);
  transform: scale(1.01);
}

.answer-form input.answer-wrong:focus {
  border-color: #7f0610;
  box-shadow:
    0 0 0 5px rgba(159, 7, 18, 0.38),
    inset 0 0 0 2px rgba(255, 255, 255, 0.42);
}

.learn-panel h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.45rem, 3vw, 2.3rem);
  line-height: 1.12;
}

.feedback {
  min-height: 1.5rem;
  color: var(--muted);
  font-weight: 750;
}

.feedback.correct {
  color: var(--green);
}

.feedback.wrong {
  color: var(--red);
}

.editor-header {
  margin-bottom: 1rem;
}

.card-editor {
  display: grid;
  gap: 0.8rem;
}

.add-card-bottom-button {
  justify-self: center;
  width: min(100%, 18rem);
  margin: 1.45rem auto 0;
}

.editor-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) minmax(0, 1fr) minmax(10rem, 14rem) auto;
  gap: 0.8rem;
  align-items: start;
  padding: 0.85rem;
  border: 1px solid rgba(215, 222, 234, 0.8);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 22px rgba(31, 37, 68, 0.06);
}

.row-number {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(66, 87, 255, 0.12), rgba(0, 166, 214, 0.14));
  color: var(--blue-dark);
  font-weight: 800;
}

.editor-row label {
  display: grid;
  gap: 0.35rem;
}

.image-editor {
  display: grid;
  gap: 0.45rem;
}

.image-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.image-preview {
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(215, 222, 234, 0.8);
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.7);
}

.image-upload {
  display: grid;
  place-items: center;
  text-align: center;
}

.image-upload input {
  display: none;
}

.editor-row textarea,
.dialog-body textarea {
  min-height: 4.6rem;
  resize: vertical;
  padding: 0.7rem;
}

dialog {
  width: min(42rem, calc(100vw - 2rem));
  border: 0;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(32, 33, 36, 0.42);
}

.card-viewer-dialog,
.pack-reveal-dialog {
  width: min(64rem, calc(100vw - 1.25rem));
  padding: 0;
  border-radius: 1rem;
  background: transparent;
  box-shadow: none;
}

.card-viewer-dialog::backdrop,
.pack-reveal-dialog::backdrop {
  background: rgba(0, 27, 31, 0.62);
  backdrop-filter: blur(8px);
}

.card-viewer-body,
.pack-reveal-body {
  position: relative;
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 1rem;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.95), transparent 13rem),
    linear-gradient(145deg, rgba(255, 250, 225, 0.98), rgba(219, 255, 243, 0.96));
  box-shadow: 0 28px 70px rgba(0, 27, 31, 0.38);
  animation: modalRise 220ms ease-out both;
}

.card-viewer-body {
  grid-template-columns: minmax(13rem, 21rem) minmax(0, 1fr);
  align-items: center;
}

.viewer-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 3;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid rgba(0, 86, 96, 0.15);
  background: rgba(255, 255, 255, 0.78);
  color: #123239;
  font-size: 1.3rem;
  line-height: 1;
}

.viewer-card-image {
  width: 100%;
  max-height: min(72vh, 34rem);
  object-fit: contain;
  border-radius: 0.75rem;
  filter: drop-shadow(0 18px 28px rgba(0, 42, 48, 0.24));
}

.card-viewer-dialog.is-locked .viewer-card-image {
  filter: grayscale(1) brightness(0.72) contrast(0.9) drop-shadow(0 18px 28px rgba(0, 42, 48, 0.2));
}

.viewer-card-copy {
  display: grid;
  gap: 0.45rem;
  padding-right: 2.5rem;
}

.viewer-card-copy h2,
.pack-reveal-copy h2,
.pack-reveal-copy p {
  margin: 0;
}

.viewer-card-copy h2 {
  color: #123239;
  font-size: clamp(1.7rem, 4vw, 3.2rem);
  line-height: 1;
}

.viewer-card-copy p {
  margin: 0;
  color: #005660;
  font-size: 1rem;
  font-weight: 900;
}

.pack-reveal-body {
  overflow: hidden;
}

.pack-reveal-dialog.is-god-pack .pack-reveal-body {
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 255, 255, 0.96), transparent 12rem),
    radial-gradient(circle at 82% 18%, rgba(255, 232, 137, 0.82), transparent 10rem),
    linear-gradient(145deg, rgba(255, 247, 219, 0.99), rgba(217, 255, 240, 0.98));
}

.pack-reveal-dialog.is-god-pack .pack-reveal-copy .eyebrow {
  width: fit-content;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: linear-gradient(145deg, #ffe889, #f2a916);
  color: #5c3500;
  box-shadow: 0 10px 22px rgba(148, 92, 0, 0.18);
}

.pack-reveal-copy {
  display: grid;
  gap: 0.15rem;
  padding-right: 2.6rem;
}

.pack-reveal-copy h2 {
  color: #123239;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1;
}

.pack-reveal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.75rem;
  max-height: 72vh;
  overflow: auto;
  padding: 0.25rem 0.1rem;
}

.pack-reveal-card {
  display: grid;
  gap: 0.45rem;
  align-content: start;
  min-height: 13.8rem;
  padding: 0.55rem;
  border: 1px solid rgba(0, 86, 96, 0.14);
  border-radius: 0.75rem;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.9), transparent 5rem),
    linear-gradient(145deg, #fff7db, #dffff1);
  box-shadow: 0 14px 30px rgba(0, 42, 48, 0.16);
  opacity: 0;
  transform: translateY(1.4rem) scale(0.92) rotate(-2deg);
  animation: cardPop 640ms cubic-bezier(0.18, 0.82, 0.2, 1) var(--reveal-delay, 0ms) both;
}

.pack-reveal-card img {
  width: 100%;
  aspect-ratio: 2.5 / 3.5;
  object-fit: contain;
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.62);
}

.pack-reveal-card strong {
  color: #123239;
  font-size: 0.88rem;
  font-weight: 950;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.pack-reveal-card span {
  width: fit-content;
  padding: 0.22rem 0.4rem;
  border-radius: 999px;
  background: rgba(0, 86, 96, 0.1);
  color: #005660;
  font-size: 0.66rem;
  font-weight: 900;
}

@keyframes modalRise {
  from {
    opacity: 0;
    transform: translateY(1rem) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cardPop {
  62% {
    opacity: 1;
    transform: translateY(-0.25rem) scale(1.04) rotate(1deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

.dialog-body {
  display: grid;
  gap: 0.8rem;
}

.dialog-body h2,
.dialog-body p {
  margin: 0;
}

.dialog-body p {
  color: var(--muted);
}

.create-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.create-choice {
  display: grid;
  gap: 0.35rem;
  min-height: 7rem;
  padding: 1rem;
  border: 1px solid rgba(0, 86, 96, 0.16);
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.9), transparent 7rem),
    linear-gradient(145deg, #effff9, #fff4d7);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 12px 24px rgba(31, 37, 68, 0.08);
}

.create-choice:hover {
  border-color: rgba(0, 128, 129, 0.38);
  transform: translateY(-1px);
}

.create-choice strong {
  font-size: 1rem;
}

.create-choice span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.25;
}

.dialog-actions {
  justify-content: end;
}

.folder-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.72rem;
  border: 1px solid rgba(215, 222, 234, 0.78);
  border-radius: 0.8rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(248, 250, 255, 0.76)),
    linear-gradient(135deg, rgba(0, 128, 129, 0.08), rgba(243, 178, 60, 0.08));
  box-shadow: 0 10px 22px rgba(31, 37, 68, 0.06);
}

.folder-card.active {
  border-color: rgba(66, 87, 255, 0.34);
  box-shadow: 0 0 0 3px rgba(66, 87, 255, 0.12), 0 12px 24px rgba(31, 37, 68, 0.08);
}

.folder-card:not(.is-expanded) {
  cursor: pointer;
}

.folder-card:not(.is-expanded) .folder-meta::after {
  content: " +";
  color: #005660;
}

[dir="rtl"] .folder-card:not(.is-expanded) .folder-meta::after {
  content: " +";
}

.folder-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: end;
}

.folder-card-header label {
  display: grid;
  gap: 0.25rem;
}

.folder-label,
.folder-meta,
.folder-empty,
.empty-library {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.folder-label {
  text-transform: uppercase;
}

.folder-name-input {
  width: 100%;
  min-height: 2.2rem;
  padding: 0 0.6rem;
  border: 1px solid rgba(215, 222, 234, 0.8);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-weight: 800;
  outline: none;
}

.folder-name-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.folder-meta,
.folder-empty,
.empty-library {
  margin: 0;
}

.folder-set-list {
  display: grid;
  gap: 0.45rem;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .set-list {
    grid-column: 1 / -1;
  }

  .sidebar-tabs {
    grid-column: 1 / -1;
  }

  .language-picker {
    grid-column: auto;
  }

  .study-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .study-mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .study-controls {
    align-content: stretch;
  }
}

@media (max-width: 680px) {
  .workspace,
  .sidebar,
  .home-screen,
  .library-screen,
  .collection-screen,
  .shop-screen,
  .info-screen {
    padding: 0.85rem;
  }

  .sidebar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .language-picker {
    min-width: 0;
  }

  .home-gallery-header {
    align-items: start;
    flex-direction: column;
  }

  .home-gallery-header span {
    text-align: left;
  }

  [dir="rtl"] .home-gallery-header span {
    text-align: right;
  }

  .editor-header,
  .answer-form {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .brand p {
    display: none;
  }

  .mode-tabs {
    width: 100%;
  }

  .set-overview {
    grid-template-columns: 1fr;
  }

  .study-mode-grid,
  .preview-card-list,
  .pack-card {
    grid-template-columns: 1fr;
  }

  .shop-header {
    align-items: stretch;
    flex-direction: column;
  }

  .shop-wallet-controls {
    justify-items: start;
  }

  .card-viewer-body {
    grid-template-columns: 1fr;
  }

  .viewer-card-image {
    max-height: 58vh;
  }

  .viewer-card-copy {
    padding-right: 0;
  }

  .pack-reveal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-tab {
    flex: 1;
    min-width: 0;
    padding: 0 0.45rem;
  }

  .editor-row {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: flex-end;
  }

  .flashcard,
  .flashcard-scene {
    min-height: 16rem;
  }

  .control-row,
  .confidence-row,
  .choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .create-choice-grid {
    grid-template-columns: 1fr;
  }

  .control-row .secondary-button,
  .confidence-row .confidence {
    width: 100%;
    min-width: 0;
    padding: 0 0.35rem;
    font-size: 0.9rem;
  }

  .study-controls {
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .card-text {
    font-size: clamp(1.45rem, 8vw, 2.35rem);
  }

  .bottom-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    bottom: 0.5rem;
    width: calc(100vw - 0.8rem);
  }

  .bottom-nav-button {
    min-height: 2.9rem;
    font-size: 0.66rem;
  }
}
