:root {
  --pl-font: ui-rounded, "Nunito", "Avenir Next", system-ui, sans-serif;
  --pl-topbar-bg: #fffdf8;
  --pl-topbar-text: #31574b;
  --pl-control-text: #41483f;
  --pl-control-bg: #fffdf8;
  --pl-control-border: #c7c1b3;
  --pl-focus: #176e83;
  --pl-overlay: rgb(20 28 25 / .62);
  --pl-card-bg: #fffdf8;
  --pl-card-text: #22241f;
  --pl-card-muted: #596158;
  --pl-card-border: #cfc7b7;
  --pl-primary: #24645f;
  --pl-primary-text: #fffdf8;
  --pl-shadow: rgb(26 37 30 / .24);
  --pl-share-bg: #f5fbef;
  --pl-radius-control: 14px;
  --pl-radius-card: 22px;
  --pl-radius-picture: 12px;
}

[data-pl="topbar"] {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  height: calc(56px + env(safe-area-inset-top));
  background: var(--pl-topbar-bg);
  box-shadow: 0 1px 0 var(--pl-card-border);
  font-family: var(--pl-font);
}

.pl-topbar__inner {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 430px);
  height: 56px;
  margin: env(safe-area-inset-top) auto 0;
  padding: 0 12px;
  gap: 8px;
}

[data-pl="back"], .pl-topbar__actions button, .pl-howto-footer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--pl-control-border);
  border-radius: var(--pl-radius-control);
  color: var(--pl-control-text);
  background: var(--pl-control-bg);
  font: 750 13px/1.15 var(--pl-font);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

[data-pl="back"] { padding: 8px; border-color: transparent; color: var(--pl-topbar-text); white-space: nowrap; }
[data-pl="back"][data-brand] { gap: 6px; background: transparent; cursor: pointer; }
[data-pl="back"][data-brand] img { width: 28px; height: 28px; flex: none; }
.pl-brand-title { font-weight: 800; }
.pl-topbar__actions { display: flex; align-items: center; gap: 8px; }
.pl-topbar__actions button { padding: 8px; border-color: transparent; background: transparent; }
.pl-howto-question { display: none; font-size: 21px; line-height: 1; }
[data-pl="topbar"] :focus-visible, [data-pl="howto-layer"] :focus-visible { outline: 3px solid var(--pl-focus); outline-offset: 2px; }

[data-pl="howto-layer"] { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: calc(64px + env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
/* Language and the way back stay pressable while the card is open. */
.playlab-howto-open [data-pl="topbar"] { z-index: 41; }
[data-pl="howto-layer"][hidden] { display: none; }
[data-pl="howto-backdrop"] { position: absolute; inset: 0; background: var(--pl-overlay); touch-action: none; }
[data-pl="howto-card"] {
  position: relative;
  width: min(100%, 430px);
  max-height: calc(100dvh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--pl-card-border);
  border-radius: var(--pl-radius-card);
  color: var(--pl-card-text);
  background: var(--pl-card-bg);
  box-shadow: 0 18px 54px var(--pl-shadow);
  font-family: var(--pl-font);
}
[data-pl="howto-card"] h2 { margin: 0 0 14px; font: 850 25px/1.1 var(--pl-font); }
[data-pl="howto-pictures"] { display: flex; justify-content: center; gap: 8px; margin-bottom: 15px; }
[data-pl="howto-pictures"] canvas, [data-pl="howto-pictures"] img, [data-pl="howto-pictures"] svg { display: block; width: min(calc(50vw - 36px), 160px); min-width: 80px; height: auto; min-height: 80px; border: 1px solid var(--pl-card-border); border-radius: var(--pl-radius-picture); background: var(--pl-card-bg); object-fit: contain; }
[data-pl="howto-lines"] { margin: 0 0 17px; padding-left: 23px; color: var(--pl-card-muted); font: 600 14px/1.38 var(--pl-font); }
[data-pl="howto-lines"].pl-howto-single { padding-left: 0; list-style: none; text-align: center; }
[data-pl="howto-lines"] li + li { margin-top: 5px; }
[data-pl="howto-credit"] { margin: -9px 0 15px; color: var(--pl-card-muted); font: 500 12px/1.35 var(--pl-font); }
[data-pl="howto-pager"] { display: flex; align-items: center; justify-content: center; gap: 14px; margin: -6px 0 14px; color: var(--pl-card-muted); font: 700 14px/1 var(--pl-font); }
[data-pl="howto-pager"][hidden] { display: none; }
[data-pl="howto-pager"] button { min-width: 44px; min-height: 44px; border: 1px solid var(--pl-control-border); border-radius: var(--pl-radius-control); color: var(--pl-control-text); background: var(--pl-control-bg); font: 800 22px/1 var(--pl-font); cursor: pointer; touch-action: manipulation; }
[data-pl="howto-pager"] button:disabled { opacity: .35; cursor: default; }
.pl-howto-footer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pl-howto-footer button { padding: 8px 10px; }
.pl-howto-footer .pl-howto-start { margin-left: auto; border-color: var(--pl-primary); color: var(--pl-primary-text); background: var(--pl-primary); font-weight: 850; }
[data-pl="share-fallback"] { position: fixed; z-index: 50; right: 12px; bottom: 12px; left: 12px; padding: 12px; border: 1px solid var(--pl-card-border); border-radius: var(--pl-radius-control); color: var(--pl-card-text); background: var(--pl-share-bg); box-shadow: 0 6px 22px var(--pl-shadow); font: 600 13px/1.35 var(--pl-font); user-select: text; white-space: pre-wrap; }

/* Between 360 and 430 px the words fit when the top-bar buttons are tighter. */
@media (min-width: 360px) and (max-width: 430px) {
  .pl-topbar__actions { gap: 4px; }
  .pl-topbar__actions button { padding: 6px 4px; font-size: 12px; }
}

@media (max-width: 359px) {
  .pl-howto-word { display: none; }
  .pl-howto-question { display: inline; }
}

@media (max-width: 359px) {
  .pl-topbar__actions button { width: 44px; padding: 4px; font-size: 11px; }
  .pl-topbar__inner { padding: 0 5px; gap: 5px; }
  .pl-topbar__actions { gap: 0; }
  [data-pl="back"][data-brand] { gap: 3px; padding: 2px; font-size: 11px; }
  [data-pl="back"][data-brand] img { width: 24px; height: 24px; }
}
