.tablet-stage {
  min-height: calc(100vh - var(--proto-bar));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 16px 28px;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(50, 239, 126, 0.18), transparent 55%),
    #dfe4e8;
}
.proto-main .tablet-stage {
  min-height: calc(100vh - var(--proto-bar));
}
.frame-tablet {
  width: min(920px, calc(100% - 16px), calc((100vh - var(--proto-bar) - 72px) * 1.6));
  border: 12px solid #1c1c1c;
  border-radius: 22px;
  background: #1c1c1c;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.frame-tablet::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 7px;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3a3a3a;
  z-index: 2;
}
.frame-tablet .screen {
  aspect-ratio: 16 / 10;
  width: 100%;
  min-height: 520px;
  background: var(--canvas);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 6px;
}
.frame-tablet .home-bar {
  height: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-top: 1px solid var(--line);
}
.frame-tablet .home-bar span {
  width: 72px;
  height: 4px;
  border-radius: 999px;
  background: #d0d5d8;
}

/* Compact tips inside the device */
.frame-tablet .tip {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11px;
  padding: 7px 8px;
  margin: 0;
  line-height: 1.35;
  min-height: 40px;
  box-sizing: border-box;
}
.frame-tablet .tip > span[data-i18n],
.frame-tablet .tip > span:not(.step-num) {
  flex: 1;
  min-width: 0;
}
.frame-tablet .step-num {
  width: 16px;
  height: 16px;
  font-size: 9px;
  flex-shrink: 0;
  margin-right: 0;
  margin-top: 1px;
  vertical-align: unset;
}
.frame-tablet .btn {
  padding: 7px 12px;
  font-size: 12px;
}
.frame-tablet .btn.sm {
  padding: 6px 10px;
  font-size: 11px;
}
.frame-tablet .h1 { font-size: 18px; }
.frame-tablet .h2 { font-size: 14px; margin-bottom: 6px; }
.frame-tablet .list-row {
  padding: 8px 10px;
  margin-bottom: 6px;
}
.frame-tablet .list-row .t { font-size: 12px; }
.frame-tablet .list-row .s { font-size: 11px; }
.frame-tablet .banner {
  font-size: 11px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.frame-tablet .card { padding: 10px; }
.frame-tablet .card .name { font-size: 13px; }
.frame-tablet .mcq a,
.frame-tablet .mcq label {
  padding: 10px;
  font-size: 12px;
}

.tab-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 14px 1px;
  background: #fff;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}
.tab-status .dots { display: flex; gap: 8px; align-items: center; }
.tab-status .bat {
  width: 16px;
  height: 8px;
  border: 1px solid var(--muted);
  border-radius: 2px;
  position: relative;
}
.tab-status .bat::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 1.5px;
  width: 2px;
  height: 4px;
  background: var(--muted);
  border-radius: 0 1px 1px 0;
}
.tab-status .bat i {
  display: block;
  height: 100%;
  width: 72%;
  background: var(--primary);
  border-radius: 1px;
}

.tab-app {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 88px 1fr;
  background: var(--canvas);
  overflow: hidden;
}
.tab-rail {
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 4px 4px 6px;
  gap: 2px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  position: relative;
  z-index: 6;
  pointer-events: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-rail.kid-rail {
  background: linear-gradient(180deg, #ffffff 0%, #f3faf6 100%);
}
.tab-rail .brand-mark {
  width: 36px;
  height: 36px;
  margin: 2px auto 4px;
  border-radius: 12px;
  background: var(--vs-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37, 204, 104, 0.25);
}
.tab-rail a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  border-radius: 12px;
  padding: 4px 2px 5px;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.1;
  flex: 0 0 auto;
  min-height: 52px;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 1;
  user-select: none;
  -webkit-tap-highlight-color: rgba(37, 204, 104, 0.25);
}
.tab-rail a:hover {
  background: rgba(37, 204, 104, 0.08);
  color: var(--ink);
}
.tab-rail a .ri {
  display: block;
  font-size: 12px;
  margin-bottom: 1px;
  line-height: 1;
  pointer-events: none;
}
.tab-rail a .kid-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 20px;
  line-height: 1;
  margin-bottom: 2px;
  background: #f0f3f2;
  color: var(--primary-deep);
  pointer-events: none;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.04);
}
.tab-rail a .kid-bubble .ico {
  width: 22px;
  height: 22px;
  color: inherit;
}
.tab-rail a .kid-label {
  font-size: 9px;
  font-weight: 700;
  pointer-events: none;
}
.tab-rail a.on {
  background: var(--primary-soft);
  color: var(--primary-deep);
}
.tab-rail a.on .kid-bubble {
  background: #fff;
  box-shadow: 0 2px 8px rgba(37, 204, 104, 0.28);
  transform: scale(1.06);
}
.tab-rail a.kid-home .kid-bubble { background: #dff7e8; }
.tab-rail a.kid-ar .kid-bubble { background: #e3f4ff; }
.tab-rail a.kid-cn .kid-bubble { background: #ffe8e0; }
.tab-rail a.kid-en .kid-bubble { background: #fff3d6; }
.tab-rail a.kid-bm .kid-bubble { background: #e0f7f4; }
.tab-rail a.kid-math .kid-bubble { background: #ebe7ff; }
.tab-rail a.kid-sci .kid-bubble { background: #e5f8e2; }
.tab-rail a.kid-apps .kid-bubble { background: #ffe4f1; }
.tab-rail .rail-avatar {
  margin-top: auto;
  flex: 0 0 auto;
  min-height: 52px;
  padding: 4px 2px;
}
.tab-rail .rail-avatar .avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
  margin: 0 auto;
  pointer-events: none;
}
.tab-rail a.kid-profile .kid-bubble {
  background: #fff0d9;
  font-size: 22px;
}

/* Kid subject / app tiles */
.tab-tile.kid {
  position: relative;
  padding: 8px;
  border-width: 2px;
  overflow: hidden;
}
.tab-tile.kid .kid-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(255,255,255,.95);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.tab-tile.kid .subject-thumb {
  height: 44px;
  border-radius: 8px;
}
.tab-tile.kid .name { font-size: 12px; }
.tab-tile.kid .meta { font-size: 10px; }
.tab-tile.kid {
  padding: 6px;
}
.tab-tile.kid .kid-badge {
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border-radius: 8px;
}
.tab-tile.kid .kid-badge .ico {
  width: 14px;
  height: 14px;
}
.tab-tile.kid .kid-app-ico {
  width: 44px !important;
  height: 44px !important;
  font-size: 24px !important;
  border-radius: 14px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: #ebf9f2 !important;
  border: none !important;
}

.tab-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tab-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.tab-toolbar .title {
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.tab-toolbar .tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
}
.tab-toolbar .credit {
  font-size: 10px;
  padding: 3px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.lang-seg-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .02em;
  white-space: nowrap;
  line-height: 1;
}
.tab-toolbar .lang-seg {
  flex-shrink: 0;
}
.tab-toolbar .lang-seg span {
  padding: 3px 6px;
  font-size: 10px;
  cursor: pointer;
  pointer-events: auto;
}
.tab-toolbar .lang-seg span:hover { color: var(--ink); }

.tab-body {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 10px;
  padding: 10px 12px;
  overflow: auto;
}
.tab-body.wide-left { grid-template-columns: 1.35fr .9fr; }
.tab-body.single { grid-template-columns: 1fr; }
.tab-col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}
.tab-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.tab-panel.fill { flex: 1 1 auto; }
/* Author display:flex must not override the HTML hidden attribute */
.tab-panel[hidden],
.frame-tablet [hidden] {
  display: none !important;
}

.tab-media {
  background: linear-gradient(155deg, #1aad55 0%, #25CC68 55%, #32EF7E 100%);
  border-radius: 12px;
  flex: 1 1 auto;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  position: relative;
}
.tab-media.cam {
  background: linear-gradient(155deg, #163528, #1aad55 40%, #25CC68);
}
.tab-media .cam-frame {
  position: absolute;
  inset: 16px 18px 34px;
  border: 2px dashed rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  pointer-events: none;
}
.tab-media .cam-hint {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.tab-media .play {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,.22);
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.tab-media .time {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(0,0,0,.28);
  padding: 3px 8px;
  border-radius: 999px;
}

.tab-feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 0;
  align-content: start;
}
.tab-feature-grid.kid-tiles {
  flex: 0 0 auto;
}
.tab-tile {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: inherit;
}
.tab-tile.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.tab-tile .ico {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #fff;
  color: var(--primary-deep);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
}
.tab-tile .name { font-weight: 700; font-size: 12px; }
.tab-tile .meta { font-size: 10px; color: var(--muted); }

.tab-continue {
  background: var(--vs-gradient);
  color: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.tab-continue .k { font-size: 10px; opacity: .9; font-weight: 600; letter-spacing: .04em; }
.tab-continue .t { font-size: 14px; font-weight: 700; margin-top: 2px; }
.tab-continue .btn { background: #fff; color: var(--primary-deep); }

.tab-foot {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: auto;
}
.tab-score { text-align: center; padding: 4px 4px 0; }
.tab-score .n {
  font-size: 30px;
  font-weight: 700;
  color: var(--primary-deep);
  line-height: 1;
}
.tab-score .m { font-size: 11px; color: var(--muted); margin: 4px 0 8px; }

.tab-editor {
  flex: 1;
  min-height: 80px;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.45;
}

.tablet-caption {
  text-align: center;
  margin: 12px auto 0;
  font-size: 13px;
  color: var(--muted);
  max-width: 640px;
}

.lock-banner {
  display: none;
  background: var(--amber-soft);
  border: 1px solid #ffd89a;
  color: #7a4a0a;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
}
html[data-soft-lock="1"] .lock-banner { display: block; }

.kid-key-features {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  flex: 0 0 auto;
}
.kid-key {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(37, 204, 104, 0.28);
  background: linear-gradient(180deg, #fff, #f3faf6);
  color: inherit;
  text-decoration: none;
  min-height: 44px;
  box-sizing: border-box;
}
.kid-key:hover {
  border-color: rgba(37, 204, 104, 0.55);
  background: #ebf9f2;
}
.kid-key .kid-app-ico,
.kid-key .ico {
  width: 28px !important;
  height: 28px !important;
  flex-shrink: 0;
  margin: 0;
  display: flex !important;
  align-items: center;
  justify-content: center;
  color: var(--primary-deep);
}
.kid-key .kid-app-ico svg,
.kid-key .ico svg {
  width: 18px;
  height: 18px;
}
.kid-key > div {
  min-width: 0;
  flex: 1;
}
.kid-key .name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.kid-key .meta {
  font-size: 10px;
  color: var(--muted);
  margin-top: 1px;
  line-height: 1.3;
}

.tab-rail a.kid-profile .kid-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}

.frame-tablet .voice-bar {
  margin-top: auto;
  flex-shrink: 0;
  align-items: center;
}

.ocr-lang-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ocr-lang-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.4;
}
.ocr-lang-row .t {
  font-weight: 700;
  color: var(--ink);
}
.ocr-lang-row .s {
  color: var(--muted);
  font-size: 11px;
  margin: 2px 0 6px;
}
.ocr-lang-row .pill {
  flex-shrink: 0;
  margin-top: 2px;
}

.essay-corrections {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.essay-corr-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary-deep);
}
.essay-corr-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12px;
}
.essay-corr-bad {
  color: #b42318;
  text-decoration: line-through;
  margin-bottom: 2px;
}
.essay-corr-good {
  color: var(--primary-deep);
  font-weight: 600;
  margin-bottom: 4px;
}
.essay-corr-why {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 800px) {
  .frame-tablet {
    width: min(100%, calc(100vw - 24px));
    border-width: 8px;
    border-radius: 16px;
  }
  .frame-tablet .screen {
    max-height: none;
    aspect-ratio: auto;
    min-height: 520px;
  }
  .tab-app { grid-template-columns: 76px 1fr; }
  .tab-body {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .tab-rail a { font-size: 8px; min-height: 48px; padding: 3px 1px; }
  .tab-rail a .kid-bubble { width: 32px; height: 32px; font-size: 18px; }
}
