:root {
  --ink: #3a2f33;
  --muted: #a0908f;
  --tint: #ffffff;
  --accent: #d9849a;
  --font: "Zen Maru Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #f8eeec; color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; touch-action: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ── 背景：淡いピンクの洗面台と、たたんだタオル ── */
.bg { position: fixed; inset: 0; overflow: hidden;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='1000'><filter id='m'><feTurbulence type='turbulence' baseFrequency='0.003 0.006' numOctaves='5' seed='4'/><feColorMatrix values='0 0 0 0 0.86  0 0 0 0 0.7  0 0 0 0 0.72  0 0 0 -6 1.05'/></filter><rect width='100%' height='100%' filter='url(%23m)'/></svg>") center / cover no-repeat,
    radial-gradient(110% 90% at 50% 40%, #fffaf9 0%, #f9ecea 55%, #f0dcda 100%);
}
.towel { position: absolute; right: -60px; bottom: 8%; width: 360px; height: 150px; border-radius: 30px; background: repeating-linear-gradient(90deg, #fff 0 6px, #f6eeee 6px 9px); filter: blur(3px); opacity: .55; box-shadow: 0 30px 60px rgba(150,90,100,.15); transform: rotate(-8deg); }
.leaf { position: absolute; left: -40px; top: 12%; width: 260px; height: 320px; border-radius: 50%; background: radial-gradient(closest-side, rgba(140,170,130,.45), transparent); filter: blur(22px); }
.glow { position: absolute; left: 50%; top: 50%; width: 900px; height: 900px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(255,255,255,.75), transparent); }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; transition: transform 1.1s cubic-bezier(.65,0,.35,1); }
canvas#c.flipped { transform: rotate(180deg); }

/* ── 上の帯 ── */
.top { position: fixed; left: 0; right: 0; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; pointer-events: none; z-index: 2; }
.top > * { pointer-events: auto; }
.logo { display: flex; align-items: baseline; gap: 8px; }
.logo .mark { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 25%, var(--accent) 100%); align-self: center; box-shadow: 0 0 0 4px rgba(255,255,255,.85); transition: background .6s; }
.logo b { font-weight: 900; letter-spacing: .06em; }
.logo small { color: var(--muted); font-size: 12px; }
.hints { display: flex; gap: 8px; font-size: 11px; color: var(--muted); }
.hints span { background: rgba(255,255,255,.75); backdrop-filter: blur(8px); padding: 4px 10px 4px 4px; border-radius: 99px; }
.hints em { font-style: normal; background: var(--ink); color: #fff; border-radius: 99px; padding: 1px 8px; margin-right: 6px; }
.right { display: flex; gap: 8px; align-items: center; }
.count, .sound { white-space: nowrap; background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border: 0; border-radius: 99px; padding: 6px 14px; font-size: 12px; font-weight: 700; box-shadow: 0 4px 14px rgba(120,60,70,.08); }
.count b { font-size: 18px; margin-left: 4px; font-family: "Cormorant Garamond", serif; font-style: italic; }
.sound span { color: var(--muted); }
.sound[aria-pressed="true"] span { color: var(--ink); }

/* ── 左の文 ── */
.copy { position: fixed; left: 30px; top: 100px; width: 300px; pointer-events: none; z-index: 1; }
.no { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.no i { font-family: "Cormorant Garamond", serif; font-size: 15px; }
.copy h1 { margin: 0; font-size: clamp(28px, 2.8vw, 40px); line-height: 1.3; font-weight: 900; letter-spacing: .03em; white-space: nowrap; }
#word { color: var(--accent); transition: color .6s; }
.desc { font-size: 12.5px; color: #6c5c5f; line-height: 1.9; margin: 14px 0 0; }

/* ── 右：もっちり度と泡の種類 ── */
.panel { position: fixed; z-index: 2; right: 26px; top: 50%; transform: translateY(-50%); width: 270px; padding: 18px; border-radius: 26px; background: rgba(255,255,255,.66); backdrop-filter: blur(14px); box-shadow: 0 20px 50px rgba(140,70,90,.12), inset 0 0 0 1px rgba(255,255,255,.85); }
.meter { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: 12px; font-weight: 700; }
.track { height: 8px; border-radius: 99px; background: rgba(160,120,130,.16); overflow: hidden; }
.track i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #f3c9d3, var(--accent)); transition: width .3s; }
.meter b { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 18px; min-width: 42px; text-align: right; }
.state { margin: 10px 0 14px; font-size: 12px; color: var(--muted); min-height: 1.4em; }
.types { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; }
.type { border: 0; background: none; padding: 0; display: grid; justify-items: center; gap: 5px; font-size: 10px; letter-spacing: -.02em; white-space: nowrap; font-weight: 700; color: var(--muted); transition: transform .3s cubic-bezier(.34,1.56,.64,1); }
.type .puff { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #fff 0 18%, var(--c) 70%, color-mix(in srgb, var(--c), #000 12%) 100%); box-shadow: 0 4px 10px color-mix(in srgb, var(--c), transparent 50%), inset 0 0 0 1px rgba(255,255,255,.6); }
.type:hover { transform: translateY(-3px); }
.type[aria-pressed="true"] { color: var(--ink); }
.type[aria-pressed="true"] .puff { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.add { margin-top: 14px; width: 100%; border: 0; border-radius: 99px; padding: 10px; font-size: 12.5px; font-weight: 700; background: #fff; box-shadow: 0 0 0 1px #eed6da; transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.add:active { transform: scale(.96); }

.done { position: fixed; z-index: 4; left: 50%; top: 66px; width: max-content; max-width: calc(100% - 24px); transform: translateX(-50%); text-align: center; background: rgba(255,255,255,.9); backdrop-filter: blur(10px); padding: 16px 24px; border-radius: 22px; box-shadow: 0 14px 40px rgba(140,70,90,.16); animation: pop .6s cubic-bezier(.34,1.56,.64,1); }
.done b { display: block; font-size: 18px; margin-bottom: 10px; }
.done-btns { display: flex; gap: 8px; justify-content: center; }
.done button { white-space: nowrap; border: 0; background: #fff; box-shadow: 0 0 0 1px #eed6da; border-radius: 99px; padding: 8px 16px; font-size: 12px; font-weight: 700; }
.done .primary { background: var(--ink); color: #fff; box-shadow: none; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 12px) scale(.9); } }

.toast { position: fixed; z-index: 5; left: 50%; bottom: 40px; transform: translate(-50%, 10px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; padding: 10px 18px; border-radius: 99px; white-space: nowrap; transition: opacity .3s, transform .3s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1099px) {
  .hints, .desc, .no { display: none; }
  .top { padding: 14px 16px; }
  .logo small { display: none; }
  .count, .sound { padding: 6px 11px; }
  .copy { left: 18px; top: 60px; width: auto; }
  .copy h1 { font-size: 24px; }
  .panel { left: 12px; right: 12px; top: auto; bottom: 12px; transform: none; width: auto; padding: 12px 14px; }
  .state { margin: 6px 0 10px; }
  .add { margin-top: 10px; padding: 8px; }
  .done { top: auto; bottom: 236px; }
  .done b { font-size: 16px; }
  .toast { bottom: auto; top: 64px; }
}
