:root { --preview-background: #e4ebf0; color-scheme: light; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; color: #292c28; background: #faf9f6; font-synthesis: none; }
* { box-sizing: border-box; }
body { margin: 0; isolation: isolate; }
.character-stamps { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; user-select: none; }
.character-stamps span { position: absolute; width: clamp(76px, 11vw, 150px); aspect-ratio: 1359 / 1125; background: url('../assets/character.png') center / contain no-repeat; opacity: 0.08; }
.character-stamps span:nth-child(1) { top: 4%; left: 6%; transform: rotate(-16deg); }
.character-stamps span:nth-child(2) { top: 12%; right: 8%; transform: rotate(12deg); }
.character-stamps span:nth-child(3) { top: 34%; left: 18%; transform: rotate(9deg) scale(.8); }
.character-stamps span:nth-child(4) { top: 40%; right: 2%; transform: rotate(-20deg); }
.character-stamps span:nth-child(5) { top: 64%; left: 2%; transform: rotate(18deg) scale(.9); }
.character-stamps span:nth-child(6) { top: 70%; right: 19%; transform: rotate(-8deg) scale(.8); }
.character-stamps span:nth-child(7) { bottom: -2%; left: 23%; transform: rotate(-12deg); }
.character-stamps span:nth-child(8) { bottom: 1%; right: 3%; transform: rotate(16deg); }
.character-stamps span:nth-child(9) { top: 8%; left: 46%; transform: rotate(-10deg) scale(.8); }
.character-stamps span:nth-child(10) { top: 44%; left: 43%; transform: rotate(14deg) scale(.85); }
.character-stamps span:nth-child(11) { bottom: 8%; left: 48%; transform: rotate(-16deg) scale(.75); }
main { width: calc(100% - 100px); max-width: 600px; margin: auto; padding: 32px 20px 24px; }
.intro { margin-bottom: 26px; }
.intro-copy { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.intro-copy h1 { flex-shrink: 0; margin: 0; }
.brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: #f5df56; font-size: 26px; font-weight: 700; margin-bottom: 12px; }
h1 { font-size: 30px; letter-spacing: -1.2px; margin: 0 0 10px; }
.intro p { min-width: 0; margin: 0; color: #64685f; line-height: 1.65; font-size: 14px; text-align: right; }
@media (max-width: 480px) { .intro-copy { gap: 12px; } .intro-copy h1 { font-size: 24px; } .intro-copy p { font-size: 12px; } }
.tool { padding: 22px; background: white; border: 1px solid #e5e5dc; border-radius: 20px; box-shadow: 0 6px 24px #353a2710; }
.label-row, .input-meta, .result-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.label-row label, legend { font-size: 14px; font-weight: 650; }
button, textarea, input { font: inherit; }
button { cursor: pointer; }
.text-button { background: none; border: none; color: #62665e; min-height: 44px; padding: 0 4px; font-size: 13px; }
button:disabled { cursor: default; }
.text-button:disabled { color: #8b8e86; }
textarea { display: block; width: 100%; min-height: 152px; resize: vertical; border: 1px solid #dedfd6; border-radius: 12px; background: #fdfdfb; padding: 16px; color: #292c28; line-height: 1.65; font-size: 16px; }
textarea::placeholder { color: #777b71; }
.input-meta { justify-content: flex-end; margin-top: 8px; color: #73776c; font-size: 12px; }
fieldset { border: 0; padding: 0; margin: 24px 0; min-width: 0; }
legend { padding: 0; margin-bottom: 10px; }
.length-options { display: flex; gap: 4px; padding: 4px; border-radius: 11px; background: #f2f3ed; }
.length-options label { flex: 1; position: relative; cursor: pointer; }
.length-options input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; }
.length-options span { display: grid; place-items: center; min-height: 44px; border-radius: 8px; color: #666b60; font-size: 14px; }
.length-options input:checked + span { background: white; color: #303629; font-weight: 700; box-shadow: 0 1px 5px #24301c14; }
.length-sidebar { position: fixed; z-index: 2; top: 50%; right: max(16px, env(safe-area-inset-right)); transform: translateY(-50%); width: 88px; max-height: calc(100dvh - 32px); overflow-y: auto; margin: 0; padding: 12px 6px; border: 1px solid #e5e5dc; border-radius: 16px; background: #fff; box-shadow: 0 4px 16px #353a2714; }
.length-sidebar legend { float: left; width: 100%; margin: 0 0 10px; text-align: center; font-size: 12px; }
.length-sidebar .length-options { clear: both; flex-direction: column; }
.length-sidebar .length-options span { padding: 6px 2px; font-size: 12px; white-space: nowrap; }
@media (max-width: 800px) {
  main { margin-left: 0; margin-right: 88px; width: calc(100% - 88px); }
  .length-sidebar { right: max(8px, env(safe-area-inset-right)); width: 76px; padding: 10px 4px; }
}
@media (max-width: 480px) { main { padding-left: 12px; padding-right: 8px; } .tool { padding: 12px; } }
:focus-visible { outline: 3px solid #677c40; outline-offset: 3px; }
.length-options input:focus-visible + span { outline: 3px solid #677c40; outline-offset: 1px; }
h2 { font-size: 16px; margin: 0; letter-spacing: -.3px; }
.result-heading { margin-bottom: 12px; }
.result-heading span { font-size: 11px; color: #73776c; }
.view-options { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 11px; background: #f2f3ed; }
.view-options button { flex: 1; min-width: 0; min-height: 44px; padding: 8px 6px; border: 0; border-radius: 8px; background: transparent; color: #666b60; font-size: 12px; line-height: 1.5; }
.view-options button[aria-pressed="true"] { background: white; color: #303629; font-weight: 700; box-shadow: 0 1px 5px #24301c14; }
.preview { display: flex; justify-content: flex-start; align-items: flex-start; background: var(--preview-background); border: 1px solid #d9e1e7; border-radius: 12px; padding: 20px 16px; min-height: 154px; max-height: 480px; overflow: auto; }
#empty-preview { width: 100%; text-align: center; color: #717968; font-size: 14px; line-height: 1.8; margin: auto; }
.bubble { display: block; flex: 0 1 auto; min-width: 0; min-height: 50px; max-width: 100%; padding: 12px 14px; border: 0; border-radius: 4px 14px 14px 14px; background: #fff; color: #292c28; font-size: 16px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; overflow: hidden; resize: none; box-shadow: 0 1px 3px #27364514; }
.preview.is-sender { justify-content: flex-end; }
.preview.is-sender .bubble { border-radius: 14px 4px 14px 14px; background: #fae46c; color: #34321e; }
[hidden] { display: none !important; }
.preview-note { font-size: 11px; color: #73776c; margin: 10px 0 18px; line-height: 1.6; }
.edit-mode-button { display: block; width: 100%; min-height: 44px; margin-top: 12px; border: 1px solid #dedfd6; border-radius: 10px; background: #fdfdfb; color: #394331; font-size: 14px; font-weight: 600; }
.edit-mode-button:hover:not(:disabled) { background: #f2f3ed; }
.edit-mode-button:disabled { color: #777a70; }
body.is-editing { overflow: hidden; }
#editor-dialog { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--preview-background); color: #292c28; overflow: hidden; }
#editor-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
#editor-dialog::backdrop { background: #292c2840; }
.editor-header { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; padding: max(12px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left)); background: var(--preview-background); box-shadow: 0 3px 12px #27364518, 0 1px 0 #2736450a; }
.editor-heading { display: flex; align-items: center; min-width: 0; min-height: 44px; }
.editor-header h2 { margin: 0; font-size: 18px; line-height: 1.4; white-space: nowrap; }
.editor-header p { margin: 6px 0 0; color: #686d61; font-size: 12px; line-height: 1.6; }
.editor-length { width: clamp(320px, 48vw, 440px); margin: 0; padding: 0; background: #d8e1e8; }
.editor-length span { min-height: 44px; padding: 6px 4px; font-size: 13px; white-space: nowrap; }
.finish-edit-button { justify-self: end; white-space: nowrap; min-height: 44px; padding: 10px 16px; border: 0; border-radius: 10px; background: #f5df56; color: #35311c; font-weight: 700; font-size: 14px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 600px) {
  .editor-header h2 { font-size: 12px; }
  .editor-header { gap: 6px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .editor-length span { font-size: 12px; }
  .finish-edit-button { padding: 10px 8px; font-size: 12px; }
}
@media (max-width: 700px) {
  .editor-header { grid-template-columns: minmax(0, 1fr) auto; row-gap: 12px; }
  .editor-heading { grid-column: 1; grid-row: 1; }
  .finish-edit-button { grid-column: 2; grid-row: 1; }
  .editor-length { grid-column: 1 / -1; grid-row: 2; justify-self: center; width: min(100%, 440px); }
  .editor-length span { font-size: 11px; }
}
.editor-surface { min-height: 0; overflow: auto; scrollbar-gutter: stable both-edges; }
.editor-content { display: flex; align-items: center; justify-content: center; min-height: 100%; padding: 24px 20px; }
.editor-surface .bubble { width: 100% !important; max-width: 600px; max-height: none; min-height: 64px; padding: 20px var(--editor-text-inset, 24px); border-radius: 4px 20px 20px 20px; background: white; box-shadow: 0 2px 8px #27364514; overflow: hidden; font-size: 18px; line-height: 1.9; text-align: left; caret-color: #394331; }
#editor-dialog.is-sender .bubble { border-radius: 20px 4px 20px 20px; background: #fae46c; color: #34321e; }
.editor-surface .bubble:focus-visible { outline: none; }
.editor-footer { margin: 0; padding: 0 20px max(16px, env(safe-area-inset-bottom)); color: #73776c; font-size: 12px; text-align: center; }
.copy-button { width: 100%; min-height: 52px; border: 0; border-radius: 12px; background: #f5df56; color: #35311c; font-weight: 700; font-size: 16px; }
.copy-button:hover:not(:disabled) { background: #efd340; }
.copy-button:disabled { background: #eeeee7; color: #777a70; }
.status { min-height: 18px; font-size: 12px; margin: 8px 0 0; text-align: center; color: #465b2d; }
.privacy { text-align: center; color: #73776c; font-size: 11px; line-height: 1.8; margin: 14px 0 0; }
.guide { margin-top: 36px; }
.guide > p, details p { color: #686d61; font-size: 14px; line-height: 1.8; }
.guide > p { margin: 12px 0 20px; }
details { border-top: 1px solid #e2e4db; }
summary { cursor: pointer; padding: 18px 0; font-size: 14px; line-height: 1.6; }
details p { margin: 0 0 18px; }
.ad-slot { margin-top: 28px; }
footer { margin-top: 32px; border-top: 1px solid #e2e4db; padding-top: 24px; color: #777b70; text-align: center; font-size: 12px; }
footer span { margin: 0 6px; } footer p { font-size: 11px; }
.notice { line-height: 1.7; color: #93420d; }
@media (max-width: 360px) { main { padding: 24px 16px; } .tool { padding: 16px; } .result-heading { align-items: flex-start; } }
@media (min-width: 640px) { main { padding-top: 48px; } .tool { padding: 28px; } }
