* { box-sizing: border-box; }
body { margin: 0; color: #263b39; background: #fff8ef; font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; }
a { color: inherit; text-decoration: none; }
.skip-link { position: absolute; top: -60px; left: 12px; z-index: 10; background: #fff; padding: 10px; }
.skip-link:focus { top: 12px; }
.header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 70px; padding: 0 max(20px, calc((100% - 860px) / 2)); border-bottom: 1px solid #eadfd1; background: #fffdf9; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: #246052; font-size: 1.3rem; font-weight: 800; letter-spacing: .02em; }
.brand-mark { font-size: 1.7rem; font-weight: 400; }
.back { color: #246052; font-size: .86rem; font-weight: 700; }
.back:hover { text-decoration: underline; }
.page { width: min(100% - 32px, 860px); margin: 30px auto 70px; }
.eyebrow { margin: 0; color: #9b7258; font-size: .72rem; font-weight: 800; letter-spacing: .15em; }
h1 { margin: 8px 0; font-size: clamp(1.8rem, 5vw, 2.7rem); line-height: 1.3; letter-spacing: -.04em; }
.intro { margin: 0 0 20px; color: #5c6d6b; font-size: .95rem; line-height: 1.8; }
.palette { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(10px, 3vw, 22px); margin: 0 0 20px; }
.color { position: relative; width: clamp(54px, 12vw, 70px); height: clamp(54px, 12vw, 70px); border: 4px solid #fff; border-radius: 50%; box-shadow: 0 2px 8px #39291b24; cursor: pointer; }
.ink-red { background: #e76755; }
.ink-yellow { background: #eea63f; }
.ink-green { background: #64a471; }
.ink-blue { background: #5a9fc6; }
.ink-purple { background: #9876b7; }
.color.is-selected { outline: 3px solid #324a46; outline-offset: 3px; }
.color.is-selected::after { position: absolute; inset: 17px; border: 3px solid #fff; border-radius: 50%; content: ""; }
.color:focus-visible, .tool:focus-visible, #undo-drawing:focus-visible, .parent-settings button:focus-visible, .parent-settings input:focus-visible, .parent-settings summary:focus-visible { outline: 3px solid #246052; outline-offset: 4px; }
.tool-picker { display: flex; justify-content: center; gap: 9px; margin: 0 0 13px; }
.tool { min-width: 96px; min-height: 48px; border: 1px solid #d6ded9; border-radius: 11px; background: #fffdf9; color: #395a53; padding: 8px 14px; font: inherit; font-size: .92rem; font-weight: 700; cursor: pointer; }
.tool.is-selected { border-color: #246052; background: #246052; color: #fff; }
#undo-drawing { min-height: 44px; border: 1px solid #d6ded9; border-radius: 10px; background: #fffdf9; color: #255a5a; padding: 8px 14px; font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer; }
#undo-drawing span { margin-right: 3px; font-size: 1.3rem; vertical-align: -.08em; }
#undo-drawing:disabled { color: #8d9995; opacity: .65; cursor: default; }
.paper { position: relative; overflow: hidden; border: 1px solid #eadfd1; border-radius: 18px; background: #fff; box-shadow: 0 10px 28px #77563817; }
#background-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#draw-canvas { position: relative; display: block; width: 100%; height: clamp(420px, 62svh, 640px); touch-action: none; cursor: crosshair; }
.below-paper { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
#save-drawing { min-height: 44px; border: 1px solid #246052; border-radius: 9px; background: #246052; color: #fff; padding: 9px 16px; font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer; }
.parent-note { margin: 16px 4px 0; color: #667673; font-size: .83rem; line-height: 1.7; }
.parent-settings { margin: 16px 4px 0; border-top: 1px solid #eadfd1; padding-top: 13px; color: #516b70; font-size: .83rem; }
.parent-settings summary { width: fit-content; cursor: pointer; }
.background-settings { margin: 18px 0 6px; border: 0; padding: 0; }
.background-settings legend { margin-bottom: 10px; font-weight: 700; }
.background-options { display: flex; flex-wrap: wrap; gap: 12px; }
.background-option { width: 104px; border: 1px solid #d6ded9; border-radius: 10px; background: #fff; color: #395a53; padding: 7px; font: inherit; font-weight: 700; cursor: pointer; }
.background-option.is-selected { border-color: #246052; box-shadow: 0 0 0 2px #246052; }
.background-preview { position: relative; display: block; height: 56px; margin-bottom: 5px; overflow: hidden; border: 1px solid #e6e9e6; border-radius: 5px; }
.background-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.preview-white { background: #fff; }
.preview-sky { background: #eef7fc; }
.preview-sky::after, .preview-field::after { position: absolute; top: 10px; right: 17px; width: 18px; height: 18px; border-radius: 50%; background: #f9df91; content: ""; }
.preview-field { background: linear-gradient(#edf7fb 0 62%, #d9edc8 62%); }
.preview-field::before { position: absolute; right: -10%; bottom: -25px; left: -10%; height: 43px; border-radius: 50%; background: #c5e2b5; content: ""; }
.asset-credit, .background-message { margin: 8px 0 0; color: #667673; font-size: .77rem; line-height: 1.7; }
.asset-credit a { color: #246052; text-decoration: underline; }
.background-message:empty { display: none; }
#save-drawing:disabled { opacity: .55; cursor: default; }
.setting-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin-top: 18px; }
.setting-row label { min-width: 120px; font-weight: 700; }
#brush-size { width: min(100%, 260px); accent-color: #246052; }
#brush-size-value { margin-left: 6px; color: #667673; font-weight: 400; }
#custom-color { width: 68px; height: 46px; border: 1px solid #cadfdb; border-radius: 8px; background: #fff; cursor: pointer; }
#custom-color-note { color: #667673; }
.setting-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 22px; border-top: 1px solid #eadfd1; padding-top: 17px; }
.setting-actions button { border: 1px solid #cadfdb; border-radius: 8px; background: #fff; color: #255a5a; padding: 9px 14px; font: inherit; cursor: pointer; }
#save-drawing:focus-visible, .background-option:focus-visible { outline: 3px solid #246052; outline-offset: 4px; }
@media (max-width: 600px) {
  .header { min-height: 60px; padding: 0 16px; }
  .brand { font-size: 1.1rem; }
  .back { font-size: .78rem; }
  .page { width: calc(100% - 24px); margin: 18px auto 40px; }
  .intro { margin-bottom: 13px; font-size: .85rem; line-height: 1.6; }
  .palette { gap: 9px; margin-bottom: 12px; }
  .tool-picker { gap: 7px; margin-bottom: 8px; }
  .tool { min-width: 0; min-height: 44px; flex: 1; padding: 6px 5px; font-size: .85rem; }
  .paper { border-radius: 14px; }
  #draw-canvas { height: min(58svh, 530px); min-height: 340px; }
}
