@charset "UTF-8";

:root {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  color: #41374c;
  background: #f8f4ed;
  font-synthesis: none;
  -webkit-tap-highlight-color: transparent;
  --ink: #41374c;
  --purple: #7865a4;
  --purple-deep: #62518b;
  --coral: #f68e7a;
  --paper: #fffdf8;
  --outline: #e8dfd4;
}
* { box-sizing: border-box; }
html, body { touch-action: manipulation; }
body { margin: 0; min-width: 290px; }
button, input { font: inherit; touch-action: manipulation; }
button, label {
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

button { cursor: pointer; }
button:focus-visible, input:focus-visible, .custom-color:focus-within {
  outline: 3px solid #7fcbbf;
  outline-offset: 3px;
}
button:disabled { cursor: not-allowed; opacity: .42; transform: none !important; }
.app-shell {
  max-width: 1500px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 16px clamp(12px, 2.3vw, 36px) 18px;
  display: flex;
  flex-direction: column;
}
.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 4px 14px;
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand-mark {
  width: 57px;
  height: 57px;
  display: grid;
  place-items: center;
  color: var(--purple);
  background: #fff9f1;
  border: 2px solid #e6d8ed;
  border-radius: 18px;
  box-shadow: 0 5px 0 #dfd1e3;
  transform: rotate(-7deg);
  flex: none;
}
.brand-mark svg { width: 44px; height: 44px; }
.eyebrow { display: block; font-size: 11px; font-weight: 900; letter-spacing: .12em; color: #9b84b3; margin-bottom: 2px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(20px, 2.5vw, 33px); letter-spacing: -.055em; line-height: 1.22; font-weight: 950; white-space: nowrap; }
h1 span { color: #ea8a7f; }
.header-sticker {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  background: #ffe6ae; border: 2px dashed #eeb264;
  color: #9a6a4f; font-size: 11px; font-weight: 950;
  line-height: 1.1; letter-spacing: -.04em; transform: rotate(15deg);
}
.workspace { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 365px); align-items: stretch; gap: 16px; min-height: 0; }
.canvas-column { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 9px; }
.stage {
  position: relative;
  isolation: isolate;
  min-height: 400px;
  flex: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid #e7ddd1;
  border-radius: 30px;
  background:
    radial-gradient(ellipse at 50% 54%, rgba(255,255,255,.68) 0%, transparent 55%),
    radial-gradient(circle at 12% 15%, #ffecdc 0, transparent 35%),
    radial-gradient(circle at 88% 80%, #e1e9e3 0, transparent 42%),
    #f0e7db;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: crosshair;
}
.stage, .stage * {
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-user-drag: none;
  touch-action: none;
}
#paintCanvas {
  transform-origin: center center;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -webkit-user-drag: none;
}
.stage::before {
  content: "";
  position: absolute; inset: 16px;
  border: 2px dashed rgba(185,160,151,.24);
  border-radius: 22px; pointer-events: none;
}
.stage::after {
  content: "";
  position: absolute;
  width: 88%; height: 75%; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.43);
  pointer-events: none; z-index: -2;
}
.stage-header { position: absolute; z-index: 4; left: 21px; top: 16px; right: 21px; display: flex; gap: 7px; justify-content: space-between; align-items: center; pointer-events: none; }
.stage-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 900; letter-spacing: .13em;
  padding: 8px 11px; border-radius: 99px;
  background: rgba(255,253,248,.83); border: 1px solid rgba(224,211,195,.8);
  color: #9d897f;
}
.live-dot { background: #ef957b; width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 0 3px #fbe1cf; }
.stage-hint { font-weight: 800; font-size: 11px; color: #a5958e; }
.stage-hint span { color: #eb988d; }
.stage-spark { position: absolute; pointer-events: none; color: #c69fc2; font-size: 33px; }
.stage-spark-one { top: 21%; left: 11%; transform: rotate(12deg); }
.stage-spark-two { bottom: 21%; right: 12%; width: 25px; height: 25px; }
.stage-spark-two svg { display: block; width: 100%; height: 100%; }
.stage-spark-three { right: 13%; top: 22%; font-size: 28px; }
.turntable-shadow {
  position: absolute; z-index: -1;
  width: min(53vw, 69dvh, 650px);
  height: min(53vw, 69dvh, 650px);
  border-radius: 50%;
  background: rgba(86,54,76,.13); filter: blur(25px);
  transform: translate(0, 25px) scaleY(.55);
  pointer-events: none;
}
.turntable-base {
  position: absolute;
  width: min(46vw, 64dvh, 610px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #b77e8a;
  transform: translateY(13px) scaleY(.988);
  box-shadow: 0 14px 2px #9c7983, 0 23px 27px rgba(87,64,84,.21);
  pointer-events: none;
}
.platter {
  width: min(46vw, 64dvh, 610px);
  aspect-ratio: 1;
  position: relative;
  border-radius: 50%;
  flex: none;
  background: conic-gradient(from 15deg,
    #efb99d 0deg, #f9d9bd 55deg, #e99fa0 112deg,
    #eac5a7 170deg, #f6e3c2 233deg, #edb5a9 292deg, #efb99d 360deg);
  border: clamp(7px, 1vw, 13px) solid #e3a1a2;
  box-shadow:
    inset 0 0 0 5px rgba(255,253,244,.57),
    inset 0 0 0 11px rgba(189,113,113,.17),
    0 7px 0 #d28c91, 0 15px 0 #a77784, 0 20px 18px rgba(74,50,62,.22);
  transform-origin: center center;
  will-change: transform;
  pointer-events: none;
}
.groove { position: absolute; inset: 1.7%; border: 1px solid rgba(119,66,81,.18); border-radius: 50%; }
.groove-two { inset: 3.7%; border-color: rgba(255,250,235,.7); border-width: 2px; }
.paint-surface {
  position: absolute; inset: 7%; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 37% 27%, #ffffff 0%, #fffdf8 65%, #f6eee1 100%);
  border: 2px solid rgba(161,133,125,.29);
  box-shadow: 0 2px 8px rgba(89,64,65,.20), inset 0 0 18px rgba(217,187,152,.14);
}
#paintCanvas { width: 100%; height: 100%; display: block; border-radius: 50%; }
.spindle { position: absolute; left: calc(50% - 3px); top: calc(50% - 3px); width: 6px; height: 6px; border-radius: 50%; background: #dacdc5; opacity: .5; box-shadow: 0 0 0 2px rgba(255,255,255,.3); pointer-events: none; }
.cursor-indicator {
  position: absolute; width: 18px; height: 18px;
  border-radius: 50%; border: 2px solid #544367;
  box-shadow: 0 0 0 2px #fff, 0 2px 5px rgba(48,34,59,.4);
  transform: translate(-50%, -50%); z-index: 5;
  pointer-events: none; display: none;
}
.stage-caption {
  position: absolute; bottom: 16px; z-index: 4;
  font-size: 12px; color: #a08c87; font-weight: 800;
  background: rgba(255,252,245,.86); border: 1px solid rgba(222,207,193,.8);
  border-radius: 20px; padding: 8px 14px;
  pointer-events: none; text-align: center;
}
.wheel-controls { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.65fr) minmax(0, .98fr) minmax(0, .9fr); gap: 9px; }
.spin-button {
  min-width: 0; min-height: 69px;
  display: flex; flex-direction: row; gap: 9px; align-items: center; justify-content: center;
  border: 2px solid #e6dad8; border-bottom-width: 5px; border-radius: 18px;
  color: #6c5972; background: #fffdf9;
  font-size: 15px; font-weight: 950; transition: background .12s, transform .12s, border-color .12s;
  white-space: nowrap;
}
.spin-button:active:not(:disabled) { transform: translateY(3px); border-bottom-width: 2px; }
.spin-button svg { width: 28px; height: 28px; flex: none; }
.spin-button.nudge svg { width: 34px; height: 34px; }
.spin-button.primary { background: #8070a6; border-color: #66568d; color: #fff; box-shadow: 0 3px 10px rgba(119,100,156,.16); }
.spin-button.primary:hover:not(:disabled) { background: #726199; }
.spin-button.primary .spin-copy { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; line-height: 1.1; }
.spin-button.stop { background: #ffe2d9; border-color: #f0c3b6; color: #b86463; }
.spin-button.stop:hover:not(:disabled) { background: #ffd6cc; }
.spin-button.nudge:hover:not(:disabled) { background: #f6f0fc; }
.spin-button.nudge { touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.spin-button.nudge.holding {
  background: #e9dff4; border-color: #9f8abf; color: #6e548e;
  box-shadow: inset 0 2px 6px rgba(84,57,116,.09);
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.speed-bars { display: flex; align-items: center; justify-content: center; gap: 3px; height: 9px; }
.speed-bars i { display: block; width: 9px; height: 7px; background: rgba(255,255,255,.28); border-radius: 3px; transition: background .12s ease; }
.speed-bars i:nth-child(1).active { background: #ffebae; }
.speed-bars i:nth-child(2).active { background: #ffe49a; }
.speed-bars i:nth-child(3).active { background: #ffcb8f; }
.speed-bars i:nth-child(4).active { background: #ffb58f; }
.speed-bars i:nth-child(5).active { background: #ff9f91; }
.speed-bars i:nth-child(6).active { background: #ff8294; }
.tool-panel { display: flex; flex-direction: column; min-width: 0; gap: 10px; }
.tool-card {
  border: 2px solid var(--outline);
  border-radius: 23px;
  background: #fffdf9;
  box-shadow: 0 3px 0 #e7ddd5;
  padding: 18px;
}
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 18px; }
.section-heading h2 { font-size: 16px; font-weight: 950; letter-spacing: -.03em; }
.tiny-decoration { font-size: 24px; color: #db9d93; transform: rotate(13deg); }
.sliders-grid { display: grid; gap: 20px; }
.slider-field { display: block; min-width: 0; cursor: pointer; }
.slider-title { font-weight: 850; font-size: 13px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.slider-title output { font-size: 12px; font-weight: 950; color: #a16f96; background: #f4eaf0; border-radius: 8px; padding: 4px 8px; min-width: 48px; text-align: center; }
input[type="range"] { display: block; width: 100%; accent-color: #8069ac; height: 18px; cursor: pointer; margin: 0; }
.field-foot { display: flex; justify-content: space-between; font-size: 10px; font-weight: 750; color: #b0a6af; margin-top: 4px; }
.palette-card { flex: 1; }
.palette-heading { margin-bottom: 14px; }
.custom-color { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 11px; font-weight: 850; color: #88728d; background: #f7edf3; border: 1px solid #ead7e0; border-radius: 100px; padding: 5px 8px; position: relative; white-space: nowrap; }
.custom-color.active { border-color: #66518e; background: #f4edf8; box-shadow: 0 0 0 2.5px #66518e; }
.custom-color input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.color-chip { width: 19px; height: 19px; border-radius: 50%; background: #514468; border: 2px solid white; box-shadow: 0 0 0 1px #e2d0d7; flex: none; }
.swatches { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 19px; }
.swatch, .favorite-slot { border-radius: 50%; padding: 0; flex: none; display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 0 0 1px #dbd0cf; position: relative; }
.swatch { width: 31px; height: 31px; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2.5px #66518e; transform: scale(1.05); }
.favorites-heading { display: flex; justify-content: flex-start; align-items: flex-start; margin-bottom: 6px; font-size: 13px; font-weight: 950; gap: 9px; }
.favorites-heading > span { white-space: nowrap; padding-top: 7px; }
.favorite-actions { display: flex; flex-direction: column; gap: 4px; align-items: stretch; min-width: 67px; }
.favorite-actions .mini-action { min-height: 25px; width: 100%; white-space: nowrap; padding: 3px 9px; }
.favorite-actions .use-favorite { background: #8170aa; border-color: #66558b; color: white; }
.favorite-actions .use-favorite:hover:not(:disabled) { background: #6f5c99; }
.favorites-heading small { font-size: 10px; color: #b5a5b1; font-weight: 750; }
.mini-action { border: 1px solid #dbcde5; color: #7e6c9a; background: #f6effc; padding: 5px 11px; font-size: 11px; font-weight: 950; border-radius: 999px; }
.mini-action:hover { background: #eae0f5; }
.favorites { display: flex; align-items: center; gap: 10px; }
.favorite-slot { width: 36px; height: 36px; border-style: dashed; border-color: #e1d6d6; background: #fffaf8; font-size: 20px; font-weight: 750; color: #d1c0ca; touch-action: manipulation; }
.favorite-slot.filled { border-style: solid; }
.favorite-slot.selected { box-shadow: 0 0 0 3px #66518e, inset 0 0 0 1px #fff; }
.favorite-slot.in-use::after {
  content: ""; position: absolute; width: 8px; height: 8px;
  border-radius: 50%; background: #7d68a8; border: 1.5px solid white;
  bottom: -4px; right: -4px;
}
.favorite-tip { font-size: 10px; color: #afa2ad; line-height: 1.5; margin-top: 11px; }
.action-card { padding: 12px; }
.utility-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.utility-button, .export-button {
  display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px;
  padding: 7px 9px; border-radius: 13px; font-size: 12px; font-weight: 950; white-space: nowrap;
}
.utility-button { border: 1px solid #ece2e0; background: #fbf7f3; color: #857784; }
.utility-button:hover:not(:disabled) { background: #f2ece5; }
.utility-button svg, .export-button svg { width: 18px; height: 18px; flex: none; }
.export-button { border: 1px solid #7762a0; background: #806bab; color: #fff; }
.export-button.share { border-color: #e09a83; background: #f4a58a; color: #633f53; }
.export-button:hover:not(:disabled) { filter: brightness(.96); }
.footnote { margin: auto 0 0; font-weight: 750; text-align: center; color: #b5a3a2; font-size: 10px; line-height: 1.5; padding: 2px; }
.footnote span { color: #f3a285; }
#toast {
  position: fixed; z-index: 20; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%;
  transform: translate(-50%, 20px); background: #493d5a; color: white; border-radius: 999px;
  padding: 11px 20px; font-weight: 800; font-size: 13px; box-shadow: 0 6px 24px rgba(35,24,46,.24);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 28px); text-align: center;
}
#toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 851px) and (max-height: 820px) {
  .app-shell { padding-top: 9px; padding-bottom: 8px; }
  .topbar { min-height: 63px; padding-bottom: 8px; }
  .brand-mark { width: 46px; height: 46px; border-radius: 15px; }
  .brand-mark svg { width: 37px; height: 37px; }
  .tool-card { padding: 13px; }
  .tool-panel { gap: 8px; }
  .section-heading { margin-bottom: 10px; }
  .sliders-grid { gap: 11px; }
  .swatches { margin-bottom: 11px; }
  .favorite-tip { margin-top: 6px; }
  .stage { min-height: 290px; }
  .wheel-controls .spin-button { min-height: 57px; }
}
@media (max-width: 850px) {
  .app-shell { padding: 9px 10px calc(9px + env(safe-area-inset-bottom)); min-height: 100dvh; }
  .topbar { min-height: 60px; padding: 0 2px 9px; }
  .brand { gap: 9px; }
  .brand-mark { width: 43px; height: 43px; border-radius: 13px; box-shadow: 0 3px 0 #dfd1e3; }
  .brand-mark svg { width: 34px; height: 34px; }
  h1 { font-size: clamp(18px, 5.0vw, 25px); letter-spacing: -.06em; }
  .eyebrow { font-size: 9px; letter-spacing: .08em; }
  .header-sticker { width: 39px; height: 39px; font-size: 8px; flex: none; }
  .workspace { display: flex; flex-direction: column; gap: 7px; }
  .canvas-column { flex: 1; gap: 5px; min-height: 0; }
  .stage { min-height: 238px; border-radius: 22px; }
  .stage::before { inset: 9px; border-radius: 16px; }
  .stage-header { left: 12px; top: 11px; right: 12px; }
  .stage-label { font-size: 9px; padding: 6px 8px; }
  .stage-hint { font-size: 9px; }
  .stage-spark-one { top: 21%; left: 8%; font-size: 23px; }
  .stage-spark-two { bottom: 18%; right: 8%; width: 18px; height: 18px; }
  .turntable-base, .platter { width: min(76vw, 42dvh, 440px); }
  .turntable-shadow { width: min(79vw, 44dvh, 465px); height: min(79vw, 44dvh, 465px); }
  .platter { border-width: 7px; box-shadow: inset 0 0 0 3px rgba(255,253,244,.57), inset 0 0 0 7px rgba(189,113,113,.17), 0 5px 0 #d28c91, 0 10px 0 #a77784, 0 14px 14px rgba(74,50,62,.19); }
  .turntable-base { transform: translateY(9px) scaleY(.988); box-shadow: 0 10px 2px #9c7983, 0 17px 17px rgba(87,64,84,.18); }
  .stage-caption { bottom: 7px; font-size: 9px; padding: 5px 9px; }
  .wheel-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1.67fr) minmax(0, .94fr) minmax(0, 1fr); gap: 6px; }
  .spin-button { min-height: 51px; border-bottom-width: 3px; border-radius: 12px; font-size: 12px; gap: 4px; padding: 3px; }
  .spin-button svg { width: 21px; height: 21px; }
  .spin-button.nudge svg { width: 26px; height: 26px; }
  .spin-button.primary .spin-copy { gap: 5px; }
  .speed-bars { gap: 3px; }
  .speed-bars i { width: 7px; height: 7px; }
  .spin-button.stop { font-size: 11px; gap: 3px; }
  .spin-button.stop svg { width: 17px; height: 17px; }
  .tool-panel { gap: 7px; }
  .tool-card { border-radius: 16px; border-width: 1.5px; box-shadow: 0 2px 0 #e7ddd5; padding: 10px 13px; }
  .section-heading { margin-bottom: 6px; }
  .section-heading h2 { font-size: 12px; }
  .sliders-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
  .slider-title { font-size: 11px; margin-bottom: 3px; }
  .slider-title output { font-size: 10px; min-width: 40px; padding: 2px 5px; }
  input[type="range"] { height: 17px; }
  .field-foot { display: none; }
  .tiny-decoration { font-size: 19px; }
  .palette-card { flex: none; }
  .palette-heading { margin-bottom: 7px; }
  .custom-color { font-size: 10px; padding: 2px 6px; }
  .color-chip { width: 16px; height: 16px; }
  .swatches { margin-bottom: 8px; gap: clamp(5px, 2vw, 8px); flex-wrap: nowrap; overflow-x: auto; padding: 3px 2px; scrollbar-width: none; }
  .swatches::-webkit-scrollbar { display: none; }
  .swatch { width: 26px; height: 26px; }
  .favorites-heading { font-size: 11px; margin-bottom: 3px; gap: 7px; }
  .favorites-heading > span { padding-top: 6px; }
  .favorite-actions { min-width: 57px; gap: 3px; }
  .favorite-actions .mini-action { min-height: 21px; padding: 2px 6px; font-size: 10px; }
  .favorites-heading small { font-size: 9px; }
  .mini-action { font-size: 10px; padding: 3px 9px; }
  .favorites { gap: 9px; }
  .favorite-slot { width: 29px; height: 29px; font-size: 16px; }
  .favorite-tip { margin-top: 4px; font-size: 9px; }
  .action-card { padding: 7px; }
  .utility-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .utility-button, .export-button { font-size: 10px; min-height: 37px; padding: 5px 4px; gap: 3px; border-radius: 9px; }
  .utility-button svg, .export-button svg { width: 16px; height: 16px; }
  .footnote { display: none; }
}
@media (max-width: 360px) {
  .brand-mark { width: 37px; height: 37px; }
  .brand-mark svg { width: 31px; height: 31px; }
  h1 { font-size: 17px; }
  .header-sticker { display: none; }
  .spin-button { font-size: 11px; }
  .spin-button svg { width: 19px; height: 19px; }
  .sliders-grid { gap: 12px; }
  .favorite-tip { font-size: 8px; }
  .utility-button, .export-button { font-size: 9px; }
}
@media (max-height: 730px) and (max-width: 850px) {
  .app-shell { padding-top: 5px; padding-bottom: 5px; }
  .topbar { min-height: 50px; padding-bottom: 5px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-mark svg { width: 30px; height: 30px; }
  .header-sticker { width: 32px; height: 32px; font-size: 7px; }
  .stage { min-height: 200px; }
  .turntable-base, .platter { width: min(71vw, 39dvh, 360px); }
  .stage-hint { display: none; }
  .wheel-controls .spin-button { min-height: 44px; }
  .stage-caption { display: none; }
  .tool-card { padding: 7px 10px; }
  .swatches { margin-bottom: 4px; }
  .favorite-tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* Drawing modes: SVG icons, never platform-dependent emoji. */
.brush-choices { display: flex; gap: 6px; align-items: center; }
.brush-choice {
  width: 34px; height: 34px; flex: none; padding: 4px;
  color: #9987ab; background: #fbf6fa; border: 1.5px solid #e5d9e8;
  border-radius: 11px; display: grid; place-items: center;
  transition: background .15s, box-shadow .15s, transform .15s;
}
.brush-choice svg { display: block; width: 22px; height: 22px; }
.brush-choice.selected, .brush-choice[aria-pressed="true"] {
  color: #fff; background: #8170a9; border-color: #64538d;
  box-shadow: 0 2px 0 #65548b;
}
.brush-choice.rainbow.selected svg { filter: drop-shadow(0 0 1px #fff); }
.brush-choice:active { transform: translateY(2px); }
.sliders-card .section-heading { flex-wrap: wrap; margin-bottom: 12px; }
.sliders-card .section-heading h2 { white-space: nowrap; }
.utility-actions { grid-template-columns: 1fr 1fr; }
.bake-btn {
  grid-column: span 2;
  background: linear-gradient(125deg, #f79f8b, #ed817b);
  border: 1.5px solid #da756f; color: #563f52;
  min-height: 48px; font-size: 15px; letter-spacing: .03em;
  box-shadow: 0 2px 0 #d98481;
}
.bake-btn:hover:not(:disabled) { filter: brightness(1.04); }
.bake-btn svg { width: 21px; height: 21px; }

.bake-overlay, .result-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 15px max(16px, env(safe-area-inset-bottom));
  background: rgba(58, 41, 68, .78); backdrop-filter: blur(10px);
}
.bake-overlay[hidden], .result-overlay[hidden] { display: none !important; }
.kiln-anim { display: flex; align-items: center; flex-direction: column; gap: 8px; text-align: center; color: white; }
.kiln-icon { width: min(62vw, 250px); filter: drop-shadow(0 12px 18px rgba(0,0,0,.18)); animation: kiln-bob 1.1s ease-in-out infinite alternate; }
.kiln-flame { transform-origin: 90px 125px; animation: flame-pulse .37s ease-in-out infinite alternate; }
.kiln-stars { font-size: 31px; color: #ffe4a3; animation: twinkle 1.2s ease-in-out infinite alternate; letter-spacing: 20px; }
.kiln-stars span { color: #eac5fc; }
.kiln-anim strong { font-size: 22px; font-weight: 950; letter-spacing: .03em; }
.kiln-anim p { font-size: 13px; color: #f2d9e8; font-weight: 750; }
@keyframes flame-pulse { from { transform: scale(.90, .94); opacity: .8; } to { transform: scale(1.08, 1.06); opacity: 1; } }
@keyframes kiln-bob { from { transform: translateY(3px); } to { transform: translateY(-6px); } }
@keyframes twinkle { from { opacity: .55; transform: scale(.97) rotate(-6deg); } to { opacity: 1; transform: scale(1.06) rotate(6deg); } }
.result-overlay { overflow-y: auto; align-items: safe center; }
.result-panel {
  width: min(100%, 470px); max-height: min(95dvh, 930px);
  margin: auto; overflow-y: auto; position: relative; text-align: center;
  padding: 22px 18px 16px; border-radius: 28px;
  background: linear-gradient(150deg, #fffcf8, #fff5ec);
  border: 3px solid #fff3d6;
  box-shadow: 0 20px 64px rgba(26,18,45,.33), inset 0 0 0 2px #ebdce8;
  scrollbar-width: thin;
}
.result-close {
  position: absolute; right: 12px; top: 10px; z-index: 2;
  width: 34px; height: 34px; border: none; border-radius: 50%;
  color: #82718e; background: #f4ecf2; font-size: 24px; line-height: 1;
}
.result-sparkles { color: #e4af68; letter-spacing: 16px; font-size: 26px; line-height: 1; animation: twinkle 1.4s infinite alternate; }
.result-sparkles span { color: #cba6dc; }
.result-overline { display: block; margin-top: 6px; color: #b28eaa; font-size: 10px; letter-spacing: .22em; font-weight: 950; }
.result-panel h2 { margin-top: 3px; color: #705580; font-size: clamp(23px, 6vw, 32px); font-weight: 950; }
.result-message { color: #a98a98; font-size: 12px; font-weight: 750; margin: 3px 0 12px; }
#resultCanvas { display: block; width: min(100%, 340px); height: auto; max-height: 56dvh; object-fit: contain; border-radius: 13px; margin: 0 auto; box-shadow: 0 6px 18px #7d58752c; background: #fff; }
.result-disclaimer { font-size: 10px; color: #a79ba4; margin: 9px 0; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result-action { min-height: 45px; border: 1px solid #69558d; border-radius: 13px; background: #806ba7; color: white; font-weight: 950; font-size: 13px; }
.result-action.share-result { color: #583e51; border-color: #e19483; background: #f4a58c; }
.return-to-paint { display: block; margin: 9px auto 0; color: #806b92; background: none; border: none; padding: 8px 15px; font-size: 12px; font-weight: 850; }
@media (max-width: 850px) {
  .sliders-card .section-heading { flex-wrap: nowrap; margin-bottom: 7px; gap: 5px; }
  .brush-choices { gap: 4px; }
  .brush-choice { width: 29px; height: 29px; padding: 3px; border-radius: 9px; }
  .brush-choice svg { width: 20px; height: 20px; }
  .utility-actions { grid-template-columns: 1fr 1fr 2.25fr; gap: 5px; }
  .bake-btn { grid-column: auto; min-height: 38px; font-size: 12px; box-shadow: none; }
  .bake-btn svg { width: 18px; height: 18px; }
  .result-panel { padding: 15px 13px 11px; }
  #resultCanvas { max-height: 52dvh; }
}
@media (max-width: 360px) {
  .brush-choice { width: 27px; height: 27px; }
  .brush-choices { gap: 3px; }
  .bake-btn { font-size: 11px; }
}
@media (max-height: 730px) and (max-width: 850px) {
  #resultCanvas { max-height: none; }
  .result-panel { padding-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .kiln-icon, .kiln-flame, .kiln-stars, .result-sparkles { animation-duration: .001ms; }
}

/* Kiln thermometer and short white flash. */
.bake-overlay { isolation: isolate; }
.kiln-temperature {
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; justify-content: center;
  font-weight: 950; font-size: 30px; color: #ffe5b0;
  letter-spacing: .055em; text-shadow: 0 3px 12px #30223855;
}
.kiln-temperature small { font-size: 15px; margin-left: 3px; }
.temperature-meter { width: min(56vw, 205px); height: 7px; overflow: hidden; border-radius: 99px; background: #ffffff34; margin: 1px 0 7px; }
.temperature-meter > div { height: 100%; width: 0; background: linear-gradient(90deg, #ffd58d, #ff9a6c, #ffede0); border-radius: inherit; }
.kiln-flash { position: absolute; z-index: 5; inset: 0; background: #fff9ed; opacity: 0; pointer-events: none; }
.kiln-flash.flashing { animation: kiln-white .3s ease-out both; }
@keyframes kiln-white { 0% { opacity: 0; } 45% { opacity: .98; } 100% { opacity: 0; } }

/* A rank adds meaningful framing, progressively richer at higher valuations. */
.result-panel { max-height: min(96dvh, 1020px); border-width: 3px; }
.result-panel[data-rank="tasty"] { border-color: #c1d4c6; box-shadow: 0 20px 64px #1a122d55, inset 0 0 0 2px #d6e7d9; }
.result-panel[data-rank="artisan"] {
  border-color: #b6a9dc;
  box-shadow: 0 20px 64px #1a122d55, inset 0 0 0 3px #dfd4f7, 0 0 24px #d2c6fd44;
}
.result-panel[data-rank="treasure"] {
  border-color: #efc76a;
  background: linear-gradient(128deg,#fffdf6 0%,#fff3d6 34%,#fffef7 52%,#ffefd0 75%,#fffdf6 100%);
  box-shadow: 0 20px 70px #1a122d66, inset 0 0 0 3px #fff3bc, 0 0 30px #ffdb79aa;
}
.result-panel[data-rank="treasure"]::before {
  content: ""; position: absolute; inset: 6px; border-radius: 22px;
  border: 1px solid #e8b65190; pointer-events: none;
}
.rank-badge {
  width: fit-content; margin: 8px auto 12px; padding: 6px 17px;
  border: 1px solid #dbc9c7; border-radius: 999px;
  background: #f7ece9; color: #8c6d80; font-size: 13px; font-weight: 950;
  letter-spacing: .08em;
}
.result-panel[data-rank="tasty"] .rank-badge { background: #eff8f0; color: #608874; border-color: #acd5b7; }
.result-panel[data-rank="artisan"] .rank-badge { background: #f2edff; color: #7653a5; border-color: #c9b3eb; }
.result-panel[data-rank="treasure"] .rank-badge {
  border-color: #d19a3d; color: #825522;
  background: linear-gradient(110deg, #ffe5a4, #fff9df 46%, #ffdc8b);
  box-shadow: inset 0 1px 1px #fff, 0 3px 10px #d7a54544;
  animation: gold-shine 2s ease-in-out infinite alternate;
}
@keyframes gold-shine { to { box-shadow: inset 0 1px 1px #fff, 0 0 18px #e5b43a88; } }
.result-panel[data-rank="treasure"] {
  background-size: 230% 100%;
  animation: treasure-sheen 5s ease-in-out infinite alternate;
}
@keyframes treasure-sheen {
  from { background-position: 0% 0%; }
  to { background-position: 100% 0%; }
}

.result-panel #resultCanvas {
  width: min(100%, 368px);
  max-height: 48dvh;
  border-radius: 16px; transform-origin: 50% 47%;
}
.result-panel #resultCanvas.pop-in { animation: plate-pop .57s cubic-bezier(.18,1.32,.42,1) both; }
@keyframes plate-pop {
  0% { transform: scale(.58); opacity: .05; filter: blur(6px); }
  62% { opacity: 1; }
  100% { transform: scale(1); opacity: 1; filter: blur(0); }
}
.appraisal { margin: 8px auto 0; max-width: 350px; }
.appraisal-caption { color: #ac8494; font-size: 11px; font-weight: 850; letter-spacing: .1em; }
.price-value {
  font-size: clamp(28px, 7vw, 38px); font-weight: 950; letter-spacing: .025em;
  color: #cc7780; line-height: 1.25; font-variant-numeric: tabular-nums;
}
.price-value.counting { animation: slot-tick .11s ease-in-out infinite alternate; }
@keyframes slot-tick { to { transform: translateY(-1.5px); opacity: .78; } }
.appraisal-breakdown {
  margin: 9px auto 4px; display: flex; flex-direction: column;
  gap: 4px; font-size: 11px; font-weight: 800; color: #8d7a8c;
}
.breakdown-row {
  opacity: 0; transform: translateY(7px);
  border-bottom: 1px dashed #e7dbe2; padding: 3px 5px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  transition: opacity .23s ease, transform .23s ease;
}
.breakdown-row.show { opacity: 1; transform: translateY(0); }
.breakdown-row strong { color: #796382; font-variant-numeric: tabular-nums; white-space: nowrap; }
.appraiser-comment {
  margin: 12px auto 7px; max-width: 340px;
  border: 1px solid #e7d7e4; background: #fcf6f7;
  border-radius: 12px; padding: 9px 11px;
  color: #735e78; font-size: 12px; font-weight: 800; line-height: 1.55;
  opacity: 0; transform: translateY(7px);
  transition: opacity .3s, transform .3s;
}
.appraiser-comment.show { opacity: 1; transform: translateY(0); }
.result-panel[data-rank="treasure"] .appraiser-comment {
  background: #fff8e6; border-color: #e8cc83; color: #8e652d;
}
.confetti-layer {
  position: fixed; inset: 0; overflow: hidden; z-index: 51;
  pointer-events: none; isolation: isolate;
}
.confetti-piece {
  position: absolute; display: block; top: -25px;
  left: var(--left); width: var(--size); height: calc(var(--size) * .56);
  border-radius: 2px; background: var(--color); opacity: 0;
  transform: rotate(var(--twist));
  animation: confetti-fall var(--duration) var(--delay) cubic-bezier(.24,.65,.5,1) forwards;
}
.confetti-piece.sparkle { clip-path: polygon(50% 0,62% 38%,100% 50%,62% 62%,50% 100%,38% 62%,0 50%,38% 38%); height: var(--size); }
@keyframes confetti-fall {
  0% { opacity: 0; transform: translate3d(0,-15px,0) rotate(var(--twist)); }
  9% { opacity: 1; }
  88% { opacity: .95; }
  100% { opacity: 0; transform: translate3d(var(--drift),105dvh,0) rotate(800deg); }
}
.photo-fallback {
  position: fixed; inset: 0; z-index: 90;
  background: #2f253cc9; backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 20px;
}
.photo-fallback[hidden] { display: none; }
.photo-fallback-panel {
  background: #fffaf6; border: 2px solid #e4d5df; border-radius: 23px;
  padding: 23px 16px 17px; width: min(100%, 420px); max-height: 90dvh;
  overflow-y: auto; position: relative; text-align: center;
}
.photo-fallback-panel h2 { margin: 0 25px 5px; font-size: 19px; color: #695580; }
.photo-fallback-panel p { margin: 0 0 14px; font-size: 12px; color: #9d8696; }
.photo-fallback-panel img { display: block; max-width: 100%; max-height: 62dvh; margin: auto; border-radius: 9px; -webkit-touch-callout: default; }
body.modal-open { overflow: hidden; }
@media (max-width: 850px) {
  .result-overlay { padding: 7px; }
  .result-panel { max-height: 96dvh; width: min(100%, 470px); padding: 14px 12px 12px; }
  .rank-badge { margin: 4px auto 8px; font-size: 12px; padding: 5px 13px; }
  .result-panel #resultCanvas { max-height: none; width: min(100%, 360px); height: auto; }
  .appraisal { margin-top: 5px; }
  .appraisal-breakdown { margin-top: 5px; gap: 2px; }
  .breakdown-row { padding: 2px 4px; }
  .appraiser-comment { margin-top: 8px; padding: 7px 9px; }
  .result-actions { margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .kiln-flash.flashing, .result-panel #resultCanvas.pop-in, .price-value.counting,
  .confetti-piece, .rank-badge, .result-panel[data-rank="treasure"] { animation: none !important; }
  .breakdown-row,.appraiser-comment { transition: none !important; }
  .confetti-piece { display: none !important; }
}

/* Six result actions are deliberately two rows × three columns. */
.result-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.result-action {
  min-width: 0; min-height: 48px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: 2px; text-align: center; white-space: nowrap; padding: 7px 4px;
  font-size: 12px; border-radius: 12px;
}
.result-action small { font-size: 9px; opacity: .9; line-height: 1.1; }
.result-action.stop-result {
  background: #f3eaf0; border-color: #d9c8d7; color: #746174;
}
.result-action.gif-save {
  background: #6b5a91; border-color: #57487b; color: white;
}
.result-action.gif-share {
  background: #eeaa90; border-color: #d99078; color: #563f54;
}
.result-action.rotate-result {
  background: #e8dcf2; color: #6a5488; border-color: #b9a6ce;
}
.result-action.rotate-result.spinning {
  background: #8170a9; color: white; border-color: #68548f;
}
.result-action:disabled {
  opacity: .5;
}
.gif-status {
  color: #94839a; text-align: center; font-weight: 750;
  font-size: 10px; min-height: 15px; margin-top: 5px;
}
@media (max-width: 850px) {
  .result-actions { gap: 6px; }
  .result-action { min-height: 40px; font-size: 11px; padding: 6px 2px; }
  .result-action small { font-size: 8px; }
  .gif-status { margin-top: 4px; font-size: 9px; }
}
