body[data-game="doodles"] .game-content { width: min(1080px, 100%); }
body[data-game="doodles"] .play-heading { padding-bottom: 16px; }
body[data-game="doodles"] .play-heading h1 { font-size: clamp(1.35rem, 2.7vw, 2rem); }
.doodles-scene { display: flex; flex-direction: column; gap: 13px; }
.doodles-stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; }
.doodles-paper { flex: 0 0 auto; position: relative; border-radius: 24px; overflow: hidden; background: #fff9ed; box-shadow: 0 4px 0 #bcb6a6, 0 8px 24px rgb(0 0 0 / 8%); }
.doodles-canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.doodles-scene[data-mode="live"] .doodles-canvas { cursor: pointer; }
.doodles-canvas:focus-visible { outline: 3px solid #568fae; outline-offset: -5px; border-radius: 24px; }
.doodles-invitation { pointer-events: none; position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #6c6d65; }
.doodles-invitation svg { width: min(220px, 54%); height: auto; }
.doodles-invitation span { font: 500 clamp(12px, 2vw, 17px)/1.4 var(--tf-font); }
.doodles-tools { flex: 0 0 auto; display: flex; justify-content: center; align-items: center; gap: 28px; min-height: 62px; }
.doodles-palette { display: flex; gap: 7px; }
.doodles-color, .doodles-eraser { display: flex; justify-content: center; align-items: center; position: relative; width: 52px; height: 52px; border: 2px solid transparent; border-radius: 50%; background: transparent; padding: 7px; touch-action: manipulation; }
.doodles-eraser { color: var(--tf-text); background: var(--tf-surface); }
.doodles-eraser svg { width: 100%; height: 100%; }
.doodles-eraser[aria-pressed="true"] { border-color: var(--tf-text); }
.doodles-color span { width: 100%; height: 100%; border-radius: 50%; background: var(--ink); box-shadow: inset 0 -3px 0 rgb(0 0 0 / 8%); }
.doodles-color[aria-pressed="true"] { border-color: var(--tf-text); }
.doodles-color[aria-pressed="true"]::after { content: '✓'; position: absolute; color: #fff9ed; font-weight: 700; text-shadow: 0 1px 2px #314751; }
.doodles-actions { display: flex; align-items: center; justify-content: center; gap: 14px; }
.doodles-tool { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 58px; min-width: 105px; border: 1px solid var(--tf-border); border-radius: 18px; padding: 3px 12px 3px 7px; background: var(--tf-surface); color: var(--tf-text); font: 600 14px/1.1 var(--tf-font); touch-action: manipulation; }
.doodles-tool svg { width: 44px; height: 44px; flex: 0 0 44px; }
.doodles-wake { background: var(--tf-accent); color: var(--tf-on-accent); border-color: transparent; }
.doodles-wake:disabled { opacity: .35; }
.doodles-friend[aria-pressed="true"] { border-color: #91bca7; box-shadow: inset 0 0 0 1px #91bca7; }
.doodles-tools [hidden], .doodles-invitation[hidden], .doodles-cursor[hidden] { display: none; }
.doodles-cursor { position: absolute; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #243c45; box-shadow: 0 0 0 2px #fff9ed; background: var(--ink); transform: translate(-50%, -50%); pointer-events: none; }
.doodles-scene[data-tool="eraser"] .doodles-cursor { background: transparent; border-style: dashed; width: 26px; height: 26px; }
.doodles-parent-tools { padding: 14px 0; border-bottom: 1px solid var(--tf-border); }
.doodles-parent-tools .tf-help { margin-bottom: 0; }
.doodles-parent-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 600px) {
  .doodles-scene { gap: 12px; }
  .doodles-tools { flex-wrap: wrap; gap: 4px; }
  .doodles-palette { gap: 4px; }
  .doodles-color, .doodles-eraser { width: 48px; height: 48px; }
  .doodles-actions { gap: 7px; }
  .doodles-tool { min-width: 82px; font-size: 12px; padding: 3px 7px; }
  .doodles-scene[data-mode="live"] .doodles-tool { flex-direction: column; gap: 0; padding: 3px 7px 8px; }
  .doodles-paper { border-radius: 18px; }
}
@media (max-width: 360px) {
  .doodles-color, .doodles-eraser { width: 44px; height: 44px; padding: 6px; }
}
@media (max-height: 600px) and (min-aspect-ratio: 1/1) {
  .doodles-scene { flex-direction: row; gap: 10px; }
  .doodles-tools { width: 114px; min-width: 114px; flex-direction: column; gap: 7px; justify-content: center; flex-wrap: nowrap; }
  .doodles-palette { display: grid; grid-template-columns: repeat(2, 44px); gap: 1px; }
  .doodles-color, .doodles-eraser { width: 44px; height: 44px; padding: 6px; }
  .doodles-actions { flex-direction: column; gap: 6px; width: 100%; }
  .doodles-tool, .doodles-scene[data-mode="live"] .doodles-tool { min-height: 44px; height: 44px; min-width: 108px; flex-direction: row; padding: 0 4px; gap: 2px; border-radius: 13px; font-size: 11px; }
  .doodles-tool svg { width: 38px; height: 38px; flex-basis: 38px; }
  body[data-game="doodles"] .play-heading { position: absolute; top: 18px; left: 156px; right: 107px; padding: 0; }
  body[data-game="doodles"] .play-heading h1 { font-size: 17px; }
  body[data-game="doodles"] .play-heading > p:last-child { font-size: 10px; margin-top: 4px; }
  body[data-game="doodles"] .play-brand { display: none; }
  body[data-game="doodles"] .play-topline { flex-basis: 66px; }
  body[data-game="doodles"] .game-content { margin-top: 0; }
  body[data-game="doodles"] .play-view { --play-bottom-space: calc(60px + env(safe-area-inset-bottom, 0px)); }
  .doodles-invitation svg { width: 140px; }
  .doodles-invitation span { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .doodles-hint { animation: none; } }

.doodles-hint .doodles-invitation svg { animation: doodles-pencil 1.1s ease-in-out; transform-origin: 70% 50%; }
@keyframes doodles-pencil { 30% { transform: rotate(-4deg); } 65% { transform: rotate(3deg); } }
.reduce-motion .doodles-invitation svg { animation: none; }
@media (prefers-reduced-motion: reduce) { .doodles-invitation svg { animation: none !important; } }

/* Drawing stays the primary surface; related tools share one compact strip. */
.doodles-drawing-tools { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.doodles-palette { align-items: center; }
.doodles-child-undo:disabled { opacity: .3; }
.doodles-sheet-tabs { display: flex; gap: 6px; justify-content: center; }
.doodles-sheet-tab { display: flex; align-items: center; gap: 5px; min-height: 44px; padding: 3px 9px; border: 1px solid var(--tf-border); border-radius: 12px; color: var(--tf-text); background: var(--tf-surface); font: 600 12px/1.2 var(--tf-font); touch-action: manipulation; }
.doodles-sheet-tab canvas { width: 42px; height: 28px; background: #fff9ed; border-radius: 5px; }
.doodles-sheet-tab[aria-pressed="true"] { border-color: var(--tf-accent); box-shadow: inset 0 0 0 1px var(--tf-accent); }
.doodles-activities { display: flex; align-items: stretch; padding: 3px; gap: 2px; border: 1px solid var(--tf-border); border-radius: 16px; background: var(--tf-surface); }
.doodles-activity { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-width: 58px; min-height: 58px; border: 1px solid transparent; padding: 2px 4px 5px; border-radius: 12px; background: transparent; color: var(--tf-text); font: 600 10px/1.2 var(--tf-font); touch-action: manipulation; }
.doodles-activity svg { width: 34px; height: 34px; }
.doodles-activity[aria-pressed="true"] { background: var(--tf-accent); color: var(--tf-on-accent); }
.doodles-tools button:focus-visible { outline: 3px solid var(--tf-accent); outline-offset: 3px; }
.doodles-actions:empty { display: none; }
.doodles-scene[data-mode="draw"] .doodles-actions { display: none; }
@media (max-width: 600px) {
  .doodles-tools { gap: 4px; }
  .doodles-palette { display: grid; grid-template-columns: repeat(5,44px); gap: 3px; }
  .doodles-color, .doodles-eraser { width: 44px; height: 44px; padding: 6px; }
  .doodles-palette .doodles-wake { grid-column: span 2; min-width: 88px; min-height: 44px; height: 44px; padding: 0 5px; font-size: 12px; }
  .doodles-palette .doodles-wake svg { width: 32px; height: 32px; flex-basis: 32px; }
  .doodles-actions { gap: 5px; flex-wrap: wrap; }
  .doodles-scene[data-mode="live"] .doodles-tool { min-width: 80px; min-height: 48px; flex-direction: row; padding: 2px 6px; font-size: 11px; }
  .doodles-scene[data-mode="live"] .doodles-tool svg { width: 32px; height: 32px; flex-basis: 32px; }
  .doodles-activity { min-width: 47px; min-height: 48px; font-size: 9px; padding: 1px 2px 3px; }
  .doodles-activity svg { width: 28px; height: 28px; }
  .doodles-activities { order: -1; }
}
@media (max-width: 380px) and (max-aspect-ratio: 1/1) {
  .doodles-actions { max-width: 288px; }
  .doodles-activities { flex-basis: 100%; justify-content: center; border: 0; background: transparent; padding: 0; }
  .doodles-activity { min-width: 68px; background: var(--tf-surface); }
}
@media (max-height: 600px) and (min-aspect-ratio: 1/1) {
  .doodles-scene { gap: 8px; }
  .doodles-tools { width: 138px; min-width: 138px; }
  .doodles-drawing-tools { gap: 3px; }
  .doodles-palette { display: grid; grid-template-columns: repeat(3,44px); gap: 2px; }
  .doodles-palette .doodles-wake { grid-column: span 2; min-width: 88px; min-height: 44px; height: 44px; padding: 0 2px; }
  .doodles-palette .doodles-wake svg { width: 30px; height: 30px; flex-basis: 30px; }
  .doodles-sheet-tabs { gap: 2px; }
  .doodles-sheet-tab { width: 67px; min-width: 0; min-height: 44px; gap: 2px; padding: 2px; font-size: 9px; }
  .doodles-sheet-tab canvas { width: 27px; height: 18px; }
  .doodles-actions { flex-wrap: nowrap; gap: 4px; }
  .doodles-activities { padding: 0; gap: 1px; border: 0; }
  .doodles-activity { width: 45px; min-width: 44px; min-height: 48px; padding: 1px; font-size: 8px; }
  .doodles-activity svg { width: 26px; height: 26px; }
  .doodles-tool, .doodles-scene[data-mode="live"] .doodles-tool { min-width: 130px; height: 44px; min-height: 44px; }
}
/* The dedicated page has its own inherited button font; scope game controls. */
.doodles-scene .doodles-tools button { font-family: var(--tf-font); font-weight: 600; line-height: 1.2; }
.doodles-tools .doodles-tool { font-size: 14px; }
.doodles-tools .doodles-sheet-tab { font-size: 12px; }
.doodles-tools .doodles-activity { font-size: 10px; }
.doodles-wake span { white-space: nowrap; }
.doodles-sheet-number { display: none; }
@media (max-width: 600px) {
  .doodles-tools .doodles-tool { font-size: 11px; }
  .doodles-tools .doodles-activity { font-size: 10px; }
}
@media (max-height: 600px) and (min-aspect-ratio: 1/1) {
  .doodles-tools .doodles-tool { font-size: 11px; }
  .doodles-tools .doodles-sheet-tab { font-size: 12px; }
  .doodles-tools .doodles-activity { font-size: 8px; }
  .doodles-sheet-label { display: none; }
  .doodles-sheet-number { display: inline; }
}
/* Free drawing has no score or progress dots; keep that space for the paper. */
body[data-game="doodles"] .game-progress { display: none; }
.doodles-scene.doodles-grabbing .doodles-canvas { cursor: grabbing; }
.doodles-brush-button { position: relative; }
.doodles-custom-swatch { display: none; position: absolute; right: 2px; bottom: 2px; width: 17px; height: 17px; border: 2px solid var(--tf-text); border-radius: 50%; background: var(--custom-ink); }
.doodles-brush-button[data-custom-color="true"] .doodles-custom-swatch { display: block; }
.doodles-brush-button[aria-expanded="true"] { border-color: var(--tf-accent); }
.doodles-brush-panel { position: fixed; z-index: 80; width: 266px; max-width: calc(100vw - 16px); padding: 12px; border: 1px solid var(--tf-border); border-radius: 18px; color: var(--tf-text); background: var(--tf-surface); box-shadow: 0 8px 28px rgb(0 0 0 / 25%); }
.doodles-brush-panel[hidden] { display: none; }
.doodles-brush-heading { font: 600 14px/1.3 var(--tf-font); margin-bottom: 9px; }
.doodles-widths { display: flex; gap: 6px; }
.doodles-brush-panel .doodles-width { flex: 1; min-height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--tf-border); border-radius: 10px; background: transparent; color: var(--tf-text); font: 500 11px/1.2 var(--tf-font); }
.doodles-width-dot { height: 18px; display: flex; align-items: center; }
.doodles-width-dot::after { content: ''; width: var(--dot); height: var(--dot); border-radius: 50%; background: currentColor; }
.doodles-width[aria-pressed="true"] { border-color: var(--tf-accent); background: var(--tf-accent); color: var(--tf-on-accent); }
.doodles-custom-label { margin: 9px 0; display: flex; align-items: center; justify-content: space-between; min-height: 44px; font: 500 13px/1.3 var(--tf-font); }
.doodles-custom-label input { width: 72px; height: 44px; padding: 3px; border: 1px solid var(--tf-border); border-radius: 8px; background: var(--tf-surface); cursor: pointer; }
.doodles-brush-panel .doodles-brush-close { width: 100%; min-height: 44px; border: 1px solid var(--tf-border); border-radius: 10px; background: transparent; color: var(--tf-text); font: 600 13px/1.2 var(--tf-font); }
@media (max-height: 600px) and (min-aspect-ratio: 1/1) {
  .doodles-tools { width: 182px; min-width: 182px; }
  .doodles-palette { grid-template-columns: repeat(4,44px); }
  .doodles-palette .doodles-wake { grid-column: span 4; }
  .doodles-sheet-tab { width: 88px; }
  .doodles-sheet-label { display: inline; }
  .doodles-sheet-number { display: none; }
  .doodles-tools .doodles-sheet-tab { font-size: 10px; }
  .doodles-sheet-tab canvas { width: 29px; height: 20px; }
}
