body.play-screen #panel :is(
  .settings-view button,
  .notebook-view button,
  .course-header .learn-summary button,
  .course-recommendation button,
  .lesson-body :is(.match-grid,.answer-grid) button,
  .lesson-body button[data-pronounce],
  .lesson-body .row-actions > button,
  .shop-view button,
  .barn-view button,
  .orders-view button,
  .villager-grid button,
  .lab-playback button,
  .vquestion-answers button,
  :where(#question-listen,#question-done),
  :where(#account-card) [data-account-action]
),
body.play-screen #panel:has(:is(.shop-view,.barn-view,.orders-view,.village-directory)) > #close-panel,
body.play-screen #world-word-card :is([data-word-listen],[data-word-saying],[data-word-reveal],[data-word-review],[data-word-back]),
body.play-screen #panel.lesson-panel .lesson-choice-feedback .lesson-footer-inner > button,
body.play-screen #level-up [data-level-up-done],
body.play-screen #onboarding:not([data-onboarding=welcome]) :is(.onboarding-options,.row-actions) > button {
  --css-frame-bg: none !important;
  --css-frame-border: none !important;
  border: 1px solid var(--control-line, #ad8ec4) !important;
  border-radius: 8px !important;
  background: var(--control-face, #fff4e3) !important;
  color: var(--control-ink, var(--ui-ink)) !important;
  box-shadow: 0 2px var(--control-edge, #a682bf) !important;
  min-height: 44px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-shadow: none;

  &:focus-visible {
    outline: 2px solid #65428b;
    outline-offset: -3px;
  }
}

body.play-screen #panel :is(
  .settings-view button[aria-pressed=true],
  .notebook-filters button[aria-pressed=true],
  .shop-tabs button[aria-selected=true]
),
body.play-screen #onboarding .onboarding-options button[aria-pressed=true] {
  --control-face: #eadcf5; --control-line: #8663a4; --control-edge: #8663a4;
}

body.play-screen #panel :is(
  [data-notebook-review-all], [data-notebook-lessons]:not(.quiet),
  [data-notebook-review], #learn-review, .course-recommendation button,
  .lesson-body .row-actions > button:not(.quiet),
  #pause,
  .shop-scroll button:not(.quiet,:disabled),
  .barn-view :is([data-qty=all],#sell):not(:disabled),
  .orders-view .order-deliver:not(:disabled),
  .villager-grid [data-villager],
  #account-card :is([data-account-action=signin],[data-account-action=retry])
),
body.play-screen #panel.lesson-panel .lesson-choice-feedback .lesson-footer-inner > button,
body.play-screen #panel #question-done,
body.play-screen #panel:has(:is(.orders-view,.village-directory)) > #close-panel,
body.play-screen #world-word-card [data-word-review],
body.play-screen #level-up [data-level-up-done],
body.play-screen #onboarding [data-onboarding-next] {
  --control-face: #ff9684; --control-line: #ba6574; --control-edge: #b76378;
}

body.play-screen #panel :is(
  .shop-scroll article,
  .barn-card,
  .order-card,
  .villager-grid article
) {
  --css-frame-bg: none !important;
  --css-frame-border: none !important;
  border: 1px solid #e3c8b9 !important;
  border-radius: 10px;
  background: #fff5e6;
  box-shadow: none;
  filter: none;
}

body.play-screen #panel :is(
  .shop-heading h2,
  .barn-heading h2,
  .village-directory > h2
) {
  --css-frame-bg: none !important;
  --css-frame-border: none !important;
  border-color: transparent;
  border-image: none;
  background: none;
  box-shadow: none;
  filter: none;
}

body.play-screen #panel :is(.shop-balance,.barn-total) {
  --css-frame-bg: none !important;
  --css-frame-border: none !important;
  border: 1px solid #e6cdb7 !important;
  border-radius: 8px;
  background: #f8e7d1;
  box-shadow: none;
}

body.play-screen #panel :is(.barn-quantity,.order-line,.order-request-body) {
  --css-frame-bg: none !important;
  --css-frame-border: none !important;
  border-image: none;
}

body.play-screen #panel .orders-view .order-request-body {
  background: #e9edf4;
  border-radius: 8px;
}

body.play-screen #panel .orders-view .order-request-body::before,
body.play-screen #panel .village-directory .villager-grid article::before {
  content: none;
}

body.play-screen #panel :is(.shop-scroll,.barn-view,.orders-view,.villager-grid) button {
  min-width: 44px;
  min-height: 44px;
}

body.play-screen #panel :is(.shop-scroll,.barn-view,.orders-view) button:disabled {
  --control-face: #f1e7da;
  --control-line: #d3c2b3;
  --control-edge: #d3c2b3;
  --control-ink: #655563;
  opacity: 1;
}

body.play-screen #panel .barn-empty {
  align-content: start;
  gap: 10px;
}

body.play-screen #panel #confirm-reset {
  --control-face: #ffd6ce;
  --control-line: #ae5d67;
  --control-edge: #ae5d67;
  --control-ink: #702939;
}

body.play-screen #panel [data-account-action=logout] {
  --control-face: #ffd6ce;
  --control-line: #ae5d67;
  --control-edge: #ae5d67;
  --control-ink: #702939;
}

body.play-screen #world-word-card :is([data-word-listen],[data-word-saying]) {
  --control-face: #eadcf5;
  min-width: 44px;
}

body.play-screen #world-word-card .world-card-example {
  --css-frame-bg: none !important;
  --css-frame-border: none !important;
  border: 1px solid #e3c8b9;
  border-radius: 8px;
  background: #fff5e6;
}

body.play-screen #panel:has(#account-card:is([data-account-view=conflict],[data-account-view=confirm],[data-account-view=offline])) {
  width: min(700px,calc(100vw - 16px));
  height: fit-content;
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  transform: none;
}

body.play-screen #panel:has(#account-card:is([data-account-view=conflict],[data-account-view=confirm],[data-account-view=offline]))::before {
  inset: 0;
}

body.play-screen #panel:has(#account-card:is([data-account-view=conflict],[data-account-view=confirm],[data-account-view=offline])) > #panel-content {
  height: auto;
  max-height: calc(100dvh - 104px);
  margin: 40px 0;
  padding: 16px clamp(20px,3vw,32px);
  scroll-padding-block: 12px;
  scrollbar-width: thin;
  scrollbar-color: #ad8ec4 #fff1df;
}

body.play-screen #panel:has(#account-card:is([data-account-view=conflict],[data-account-view=confirm],[data-account-view=offline])) > #close-panel {
  inset: 36px 22px auto auto;
  width: 44px;
  height: 44px;
}

body.play-screen #panel #account-card:is([data-account-view=conflict],[data-account-view=confirm],[data-account-view=offline]) {
  overflow-wrap: anywhere;

  &::before, & .eyebrow::before, & .eyebrow::after { content: none; }

  & :is(.eyebrow,h2) {
    --css-frame-bg: none !important;
    --css-frame-border: none !important;
    width: auto;
    height: auto;
    min-height: 0;
    margin: 0 48px 8px 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    color: var(--ui-ink);
  }

  & .eyebrow { font-size: 14px; justify-content: start; }
  & h2 { font-family: inherit; font-size: clamp(21px,4vw,32px); line-height: 1.15; }
  & .account-intro, & .account-conflict h3, & .account-conflict > p, & .account-save {
    margin-inline: 0;
    padding-inline: 0;
  }
  & .account-intro { margin-block: 6px 10px; }
  & .farm-choices { gap: 10px; margin: 10px 0 0; }
}

@media (max-width: 359px) {
  body.play-screen #panel #account-card[data-account-view=conflict] {
    & .account-conflict { margin-block: 10px; }
    & .farm-choice-title, & .account-conflict h3 { font-size: 17px; }
    & .account-intro, & .account-conflict p { font-size: 14px; }
    & .farm-choices { gap: 8px; }
  }
}

body.play-screen #panel #account-card .farm-choices > div {
  --css-frame-bg: none !important;
  --css-frame-border: none !important;
  position: relative;
  min-width: 0;
  padding: 10px;
  border: 1px solid #e3c8b9 !important;
  border-radius: 9px;
  background: #fff5e6;
}

body.play-screen #panel #account-card .farm-choices p { white-space: normal; }

body.play-screen #panel #account-card .farm-choices button {
  min-height: 44px;
  margin-top: 8px;
}

body.play-screen #level-up .level-up-panel h3,
body.play-screen #level-up .level-up-grid {
  --css-frame-bg: none !important;
  --css-frame-border: none !important;
  margin-block: 10px 0;
  padding: 6px;
  border: 0;
  background: none;
  box-shadow: none;
}

body.play-screen #level-up .level-up-grid article {
  --css-frame-bg: none !important;
  --css-frame-border: none !important;
  position: relative;
  border: 1px solid #e3c8b9;
  border-radius: 9px;
  background: #fff5e6;
}

body.play-screen #panel :is(.lesson-body .match-grid,.lesson-body .answer-grid,.vquestion-answers) button {
  --control-face: #fff0cb;
}
body.play-screen #panel .lesson-body .match-grid button.selected {
  --control-face: #ffe2ae; --control-line: #b56258; --control-edge: #b56258;
}
body.play-screen #panel :is(
  .lesson-body .match-grid button.matched,
  .lesson-body .answer-grid button.correct-answer,
  .vquestion-answers button:is([data-answer-state=right],[data-answer-state=reveal])
) {
  --control-face: #e0edc7; --control-line: #809b65; --control-edge: #809b65; --control-ink: #38542a;
}
body.play-screen #panel :is(
  .lesson-body .match-grid button[aria-invalid=true],
  .lesson-body .answer-grid button.wrong-answer,
  .vquestion-answers button[data-answer-state=wrong]
) {
  --control-face: #ffded5; --control-line: #bb747a; --control-edge: #bb747a; --control-ink: #783b47;
}

body.play-screen #panel.settings-panel :is(
  .settings-profile-card, .settings-reset-confirm, .settings-switches,
  .settings-section h3, .settings-section-icon
),
body.play-screen #panel .notebook-view :is(.notebook-word,.notebook-detail,.notebook-stats > div) {
  --css-frame-bg: none !important;
  --css-frame-border: none !important;
  border: 1px solid #e3c8b9 !important;
  border-radius: 9px;
  background: var(--notebook-row-fill, #fff5e6) !important;
  box-shadow: none;
}

body.play-screen #panel.settings-panel :is(.settings-section h3,.settings-section-icon) {
  border: 0 !important;
  border-radius: 0;
  background: none !important;
}

body.play-screen #panel.settings-panel .settings-section h3 {
  width: 100%;
  min-height: 0;
  padding: 0 0 8px;
  border-bottom: 1px solid #e3c8b9 !important;
}

body.play-screen #panel.settings-panel .settings-profile-card {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px;
  min-height: 0;
  padding: 10px;
}

body.play-screen #panel.settings-panel .settings-profile-card :is(#settings-profile,#settings-account) {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 6px 8px;
}

body.play-screen #panel.settings-panel .settings-view .interface-languages button {
  min-height: 44px;
}

body.play-screen #panel.settings-panel > #panel-content {
  height: 100%;
  max-height: 100%;
  padding-bottom: 20px;
  scrollbar-width: thin;
  scrollbar-color: #ad8ec4 #fff1df;
}

body.play-screen #panel:has(.notebook-view[data-empty=false]) {
  width: min(820px,calc(100vw - 16px));
  height: min(740px,calc(100dvh - 24px));
  padding: 20px clamp(14px,2.5vw,32px) 24px;
  transform: none;
}

body.play-screen #panel:has(.notebook-view[data-empty=false])::before {
  --css-frame-bg: var(--css-ref-learning-notebook-body) !important;
  --css-frame-border: none !important;
  inset: 0;
}

body.play-screen #panel .notebook-view[data-empty=false] h2 {
  position: static;
  width: fit-content;
  max-width: calc(100% - 48px);
  min-height: 44px;
  transform: none;
  margin: 0 0 12px;
  padding: 0 0 0 4px;
}

body.play-screen #panel .notebook-view[data-empty=false] :is(.notebook-stats,.notebook-filters,.notebook-count) {
  margin-inline: 0;
}

/* Native rows no longer get the frame runtime's positioned paint hosts. */
body.play-screen #panel .notebook-view :is(
  .notebook-word, .notebook-detail, .notebook-scroll, .notebook-listen,
  .notebook-filters, .notebook-count, [data-notebook-review-all],
  .notebook-meaning, .notebook-growth, .word-plant
) {
  position: relative;
}

body.play-screen #panel .notebook-view .notebook-word {
  --notebook-row-fill: #fff8ed;
}

body.play-screen #panel .notebook-view .notebook-word-header {
  min-height: 0;
  padding: 6px 10px 10px;
  align-items: center;
}

body.play-screen #panel .notebook-view .notebook-word-header .word-plant {
  align-self: center;
}

body.play-screen #panel .notebook-word:has(.notebook-toggle[aria-expanded=true]) .word-plant {
  align-self: start;
}

body.play-screen #panel .notebook-view [data-notebook-review-all] {
  margin-bottom: 8px;
}

body.play-screen #panel .notebook-view .notebook-toggle {
  --control-face: transparent;
  --control-line: transparent;
  --control-edge: transparent;
  padding: 4px 0;
}

body.play-screen #panel .notebook-view .notebook-toggle:hover {
  --control-face: #f6e8ee;
}

body.play-screen #panel .notebook-view .notebook-toggle::after {
  content: none;
}

body.play-screen #panel .notebook-view .notebook-toggle strong { font-size: clamp(17px, 2vw, 22px); }
body.play-screen #panel .notebook-view .notebook-detail {
  --notebook-row-fill: #faeee8;
  margin: 0 0 8px;
}
body.play-screen #panel .notebook-view .notebook-listen {
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
}

body.play-screen #panel .notebook-view .notebook-listen > span {
  width: 19px;
  height: 19px;
  font-size: 0;
  background: var(--learning-speaker) center / contain no-repeat;
}
body.play-screen #panel .notebook-scroll {
  scrollbar-color: #ad8ec4 #fff1df;
}

body.play-screen #panel .village-question #question-listen {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
}

body.play-screen #panel .village-question #question-listen::before {
  content: "";
  width: 20px;
  height: 20px;
  background: var(--learning-speaker) center / contain no-repeat;
}

@media (max-width: 699px) {
  body.play-screen #panel.settings-panel,
  body.play-screen #panel.settings-panel:has(.settings-reset-confirm) { padding-top: 64px; }

  body.play-screen #panel.settings-panel > #panel-content {
    padding-inline: 16px;
  }

  body.play-screen #panel.settings-panel .settings-heading,
  body.play-screen #panel.settings-panel:not(:has(.settings-reset-confirm)) .settings-heading,
  body.play-screen #panel.settings-panel:has(.settings-reset-confirm) .settings-heading {
    inset: 12px 70px auto 16px;
    width: auto;
    height: auto;
  }

  body.play-screen #panel.settings-panel .settings-heading h2 {
    --css-frame-bg: none !important;
    --css-frame-border: none !important;
    width: auto;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: 0 !important;
    background: none !important;
    box-shadow: none;
    font-size: clamp(19px, 5.5vw, 26px);
    overflow-wrap: anywhere;
  }

  body.play-screen #panel.settings-panel > #close-panel,
  body.play-screen #panel.settings-panel:has(.settings-reset-confirm) > #close-panel {
    top: 12px;
    right: 12px;
  }

  body.play-screen #panel .notebook-view .notebook-filters::after { display: none; }
  body.play-screen #panel.course-board .course-header .learn-summary button {
    padding: 5px 8px;
    white-space: normal;
  }

  body.play-screen #panel.lesson-panel .lesson-choice-feedback::before {
    content: none;
  }

  body.play-screen #panel.lesson-panel .lesson-choice-feedback .lesson-header {
    height: auto;
    padding-bottom: 10px;
  }

  body.play-screen #panel.lesson-panel .lesson-choice-feedback .lesson-scroll {
    flex: 0 1 auto;
    border: 1px solid #ad8ec4;
    border-radius: 12px;
    background: #fff1df;
    scrollbar-width: thin;
    scrollbar-color: #ad8ec4 #fff1df;
  }

  body.play-screen #panel.lesson-panel .lesson-choice-feedback .lesson-footer {
    --css-frame-bg: none !important;
    --css-frame-border: none !important;
    min-height: 0;
    padding: 12px 14px;
    border: 1px solid #8aa473;
    border-radius: 12px;
    background: #f0f5de;
  }

  body.play-screen #panel.lesson-panel .lesson-choice-feedback .lesson-footer.wrong {
    border-color: #c48b83;
    background: #fff0e6;
  }

  body.play-screen #panel.lesson-panel .lesson-shell:has(.match-grid) .lesson-scroll {
    scrollbar-width: thin;
    scrollbar-color: #ad8ec4 #fff1df;
    scroll-padding-block: 8px;
  }

  body.play-screen #panel.lesson-panel .lesson-shell:has(.match-grid) .match-grid button {
    height: auto;
    min-height: 44px;
    padding: 6px 7px;
  }

  body.play-screen #panel.lesson-panel .lesson-shell:has(.match-grid) .match-grid button.matched {
    padding-inline-end: 25px;
  }
}

@media (max-width: 359px) {
  body.play-screen #panel.lesson-panel .lesson-choice-feedback .lesson-body .answer-grid button {
    padding: 6px 8px;
    font-size: 16px;
  }
  body.play-screen #panel.lesson-panel .lesson-choice-feedback .lesson-body .answer-grid button:is(.correct-answer,.wrong-answer) {
    padding-inline-end: 24px;
  }
  body.play-screen #panel.lesson-panel .lesson-choice-feedback .choice-status {
    right: 7px;
    font-size: 17px;
  }
  body.play-screen #panel.lesson-panel .lesson-shell:has(.match-grid):not(:has(.lesson-footer)) {
    height: min(520px,calc(100dvh - 50px));
    margin-top: 20px;
  }
  body.play-screen #panel.lesson-panel .lesson-shell:has(.match-grid):not(:has(.lesson-footer)) .lesson-header {
    padding-top: 16px;
  }
  body.play-screen #panel.lesson-panel .lesson-shell:has(.match-grid):not(:has(.lesson-footer)) .exercise-counter {
    margin-bottom: 8px;
  }
  body.play-screen #panel.lesson-panel .lesson-shell:has(.match-grid):not(:has(.lesson-footer)) .lesson-body > p:not(.exercise-counter) {
    margin-bottom: 10px;
  }
}
