/* NewYear.run — tool styles (DESIGN.md: midnight plum + grapes + gold).
   Palette: night #17102B, panel #241845, grape #7C4DBD, love #F0566A,
   luck #57C46B, gold #E9B44C, cream #FFF9F0, ink #2A2140, muted #B9AEDD. */
.nyr { color: var(--nyr-cream, #FFF9F0); font-family: Nunito, system-ui, sans-serif; }
.nyr [hidden] { display: none !important; }
.nyr-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nyr h1, .nyr .nyr-bunch-title { font-family: Fraunces, Georgia, serif; }

.nyr-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; margin: 10px 0 18px; }
.nyr-h1 { font-size: 2.1rem; line-height: 1.15; font-weight: 700; margin: 6px 0 10px; color: #FFF9F0; }
.nyr-hero-lines { margin: 0 0 16px; color: #B9AEDD; font-size: 1.02rem; line-height: 1.55; }
.nyr-hero-lines span { display: block; }
.nyr-hero-stage { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.nyr-demoline { color: #B9AEDD; font-size: .88rem; text-align: center; margin: 4px 0; max-width: 430px; }
.nyr-minechip { background: #241845; color: #FFF9F0; border: 1px solid #7C4DBD; border-radius: 999px; padding: 8px 16px; font: 700 .9rem Nunito, sans-serif; cursor: pointer; }

/* ---------- grape bunch frame (DESIGN.md §4 hard spec) ---------- */
.nyr-frame { position: relative; width: min(92vw, 430px); aspect-ratio: 4 / 5; margin: 0 auto; }
.nyr-leaf { position: absolute; left: 50%; top: 0; transform: translateX(-50%); width: 30%; z-index: 1; pointer-events: none; }
.grape { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; padding: 0; cursor: pointer; z-index: 2;
  -webkit-tap-highlight-color: transparent; }
.grape::after { /* touch extension */
  content: ''; position: absolute; inset: -4px; border-radius: 50%; }
.grape .g-hi { position: absolute; left: 20%; top: 14%; width: 30%; height: 24%; border-radius: 50%;
  background: rgba(255,255,255,.55); pointer-events: none; }
.grape.empty { background: rgba(124,77,189,.16); border: 2px solid #7C4DBD; }
.grape.empty:hover { background: rgba(124,77,189,.3); }
.grape.green { background: radial-gradient(circle at 32% 28%, #8FE09B, #57C46B 55%, #2F8F46); border: 2px solid #2F8F46; cursor: pointer; }
.grape.red { background: radial-gradient(circle at 32% 28%, #FF9DAB, #F0566A 55%, #C9334E); border: 2px solid #C9334E; cursor: pointer; }
.grape.anon { box-shadow: 0 0 0 3px #17102B, 0 0 0 5px #E9B44C; }
.grape.anon .g-moon { position: absolute; right: 6%; bottom: 4%; width: 22%; height: 22%; color: #E9B44C; pointer-events: none; }
.grape.opened { opacity: .55; }
.grape.opened .g-check { position: absolute; right: 2%; top: 0; color: #E9B44C; font-weight: 900; font-size: 15px; }
.grape.next { animation: nyr-pulse 1.6s ease-in-out infinite; box-shadow: 0 0 0 4px rgba(233,180,76,.35), 0 0 26px 6px rgba(233,180,76,.55); }
@keyframes nyr-pulse { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.07); } }
.grape-cap { position: absolute; transform: translate(-50%, 0); background: rgba(10,6,24,.72); color: #FFF9F0;
  font-size: 11px; font-weight: 700; text-align: center; border-radius: 999px; padding: 2px 0; z-index: 3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }

/* ---------- cards & forms ---------- */
.nyr-card { background: #FFF9F0; color: #2A2140; border-radius: 20px; padding: 20px; box-shadow: 0 10px 28px rgba(0,0,0,.35); }
.nyr-create-card { margin-top: 4px; }
.nyr-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.nyr-h { font-family: Fraunces, Georgia, serif; font-size: 1.3rem; font-weight: 600; margin-bottom: 6px; }
.nyr-sub { color: #5C5470; margin: 0 0 10px; line-height: 1.5; }
.nyr-label { display: block; font-weight: 700; font-size: .9rem; margin: 12px 0 6px; }
.nyr-label:first-child { margin-top: 0; }
.nyr-input { width: 100%; box-sizing: border-box; background: #fff; border: 2px solid #D9D2F0; border-radius: 12px;
  padding: 11px 13px; font: 400 1rem Nunito, sans-serif; color: #2A2140; }
.nyr-input:focus { outline: none; border-color: #7C4DBD; }
textarea.nyr-input { min-height: 92px; resize: vertical; }
.nyr-goals { display: flex; flex-wrap: wrap; gap: 8px; }
.gchip { border: 2px solid #D9D2F0; background: #fff; color: #2A2140; border-radius: 999px; padding: 7px 14px;
  font: 700 .88rem Nunito, sans-serif; cursor: pointer; min-height: 40px; }
.gchip.sel { background: #7C4DBD; border-color: #7C4DBD; color: #FFF9F0; }
.nyr-btn { display: inline-block; background: transparent; color: #2A2140; border: 2px solid #7C4DBD; border-radius: 999px;
  padding: 11px 22px; font: 800 .95rem Nunito, sans-serif; cursor: pointer; text-decoration: none; text-align: center; }
.nyr-btn.primary { background: #7C4DBD; border-color: #7C4DBD; color: #FFF9F0; }
.nyr-btn.big { padding: 13px 26px; font-size: 1.02rem; }
.nyr-btn:hover { filter: brightness(1.07); }
.nyr-btn:active { transform: translateY(1px); }
.nyr-btn:disabled { opacity: .55; cursor: default; transform: none; }
.nyr-btnrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.nyr-meta { color: #8A81A8; font-size: .85rem; font-weight: 700; margin: 10px 0 0; }
.nyr-msg { color: #C9334E; font-weight: 700; margin: 10px 0 0; }
.nyr-msg.ok { color: #2F8F46; }
.nyr-fine { color: #5C5470; font-size: .88rem; line-height: 1.5; }
.nyr-warn { color: #C9334E; font-size: .9rem; font-weight: 700; line-height: 1.5; }
.nyr-savehint { color: #5C5470; font-size: .9rem; line-height: 1.5; }
.nyr-linkrow { display: flex; gap: 8px; }
.nyr-linkrow .nyr-input { flex: 1; }
.nyr-codebig { font-family: ui-monospace, Menlo, monospace; font-size: 1.7rem; font-weight: 800; letter-spacing: .12em; color: #7C4DBD; margin: 2px 0 6px; }
.nyr-created { margin: 16px 0; }
.nyr-created-h { font-family: Fraunces, Georgia, serif; font-size: 1.4rem; font-weight: 700; }
.nyr-mine { list-style: none; margin: 8px 0 0; padding: 0; }
.nyr-mine li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 0; }
.mine-open { background: none; border: none; font: 800 1rem Nunito, sans-serif; color: #7C4DBD; cursor: pointer; padding: 6px 0; }
.mine-copy { background: #fff; border: 2px solid #D9D2F0; border-radius: 999px; padding: 6px 14px; font: 700 .85rem Nunito, sans-serif; cursor: pointer; color: #2A2140; }

/* ---------- bunch page ---------- */
.nyr-backlink { color: #B9AEDD; font-weight: 700; text-decoration: none; display: inline-block; margin: 6px 0 10px; }
.nyr-bscene { background: #241845; border-radius: 24px; padding: 22px 16px 16px; box-shadow: 0 10px 28px rgba(0,0,0,.35); }
.nyr-bunch-title { font-size: 2rem; line-height: 1.15; font-weight: 700; text-align: center; color: #FFF9F0; }
.nyr-bstatus { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 2px; color: #B9AEDD; font-weight: 700; }
.code-chip { background: rgba(10,6,24,.5); border-radius: 999px; padding: 3px 12px; font-size: .8rem; color: #B9AEDD; }
.code-chip b { color: #E9B44C; font-family: ui-monospace, Menlo, monospace; }
.nyr-goalchips { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 2px; }
.nyr-goalchips .gchip { background: transparent; border-color: #7C4DBD; color: #FFF9F0; cursor: default; min-height: 0; padding: 4px 12px; }
.mile-line { text-align: center; color: #B9AEDD; font-weight: 700; margin: 8px 0 4px; }
.nyr-rushrow { display: flex; justify-content: center; margin: 10px 0 4px; }
.nyr-sharebar { display: flex; align-items: center; gap: 10px; width: fit-content; max-width: 100%; margin: 12px auto 4px;
  background: rgba(10,6,24,.55); border-radius: 999px; padding: 6px 6px 6px 16px; }
.nyr-sharebar-link { color: #B9AEDD; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.share-card { margin: 16px 0; }
.nyr-tpls { display: grid; gap: 10px; margin-top: 8px; }
.nyr-tpl { text-align: left; background: #fff; border: 2px solid #D9D2F0; border-radius: 14px; padding: 12px 14px; cursor: pointer; font-family: Nunito, sans-serif; }
.nyr-tpl:hover { border-color: #7C4DBD; }
.nyr-tpl .tpl-t { display: block; font-weight: 800; color: #2A2140; margin-bottom: 4px; }
.nyr-tpl .tpl-p { display: block; color: #5C5470; font-size: .88rem; line-height: 1.45; }
.nyr-cta { text-align: center; padding: 22px 10px 8px; color: #FFF9F0; }
.nyr-cta p { margin: 0 0 12px; line-height: 1.5; }
.nyr-result { margin: 16px 0; text-align: center; }
.nyr-result .rtype { font-family: Fraunces, Georgia, serif; font-size: 1.9rem; font-weight: 700; color: #B97F16; margin: 4px 0 8px; }
.nyr-result .rdots { display: flex; justify-content: center; gap: 6px; margin: 10px 0; }
.nyr-result .rdot { width: 18px; height: 18px; border-radius: 50%; }
.nyr-result .rdot.red { background: radial-gradient(circle at 32% 28%, #FF9DAB, #F0566A 60%, #C9334E); }
.nyr-result .rdot.green { background: radial-gradient(circle at 32% 28%, #8FE09B, #57C46B 60%, #2F8F46); }
.nyr-result .rdot.empty { background: rgba(124,77,189,.18); border: 2px solid #7C4DBD; box-sizing: border-box; }

/* ---------- modal ---------- */
.nyr-modal { position: fixed; inset: 0; background: rgba(10,6,24,.66); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center; z-index: 60; }
.nyr-sheet { background: #241845; color: #FFF9F0; border-radius: 22px 22px 0 0; width: min(560px, 100%); max-height: 88vh;
  overflow-y: auto; padding: 24px 22px 26px; position: relative; box-shadow: 0 -12px 40px rgba(0,0,0,.5); }
@media (min-width: 641px) { .nyr-modal { align-items: center; } .nyr-sheet { border-radius: 22px; } }
.nyr-sheet h3 { font-family: Fraunces, Georgia, serif; font-size: 1.35rem; margin: 0 24px 8px 0; }
.nyr-sheet .nyr-label { color: #B9AEDD; }
.nyr-sheet .nyr-sub { color: #B9AEDD; }
.nyr-sheet .nyr-fine { color: #B9AEDD; }
.nyr-sheet .nyr-input { background: #17102B; border-color: #4A3A7A; color: #FFF9F0; }
.nyr-x { position: absolute; right: 12px; top: 10px; background: none; border: none; color: #B9AEDD; font-size: 1.7rem; cursor: pointer; line-height: 1; padding: 6px; }
.nyr-count { text-align: right; color: #B9AEDD; font-size: .8rem; font-weight: 700; }
.wish-card { text-align: center; }
.wish-orn { display: flex; justify-content: center; margin-bottom: 6px; }
.wish-grape { width: 74px; height: 74px; border-radius: 50%; position: relative; }
.wish-grape.green { background: radial-gradient(circle at 32% 28%, #8FE09B, #57C46B 55%, #2F8F46); }
.wish-grape.red { background: radial-gradient(circle at 32% 28%, #FF9DAB, #F0566A 55%, #C9334E); }
.wish-grape .g-hi { position: absolute; left: 20%; top: 14%; width: 30%; height: 24%; border-radius: 50%; background: rgba(255,255,255,.55); }
.wish-from { margin: 6px 0; }
.wish-sealed { color: #B9AEDD; line-height: 1.55; }
.nyr-note-text { background: #17102B; border: 1px solid #4A3A7A; border-radius: 14px; padding: 14px; line-height: 1.6;
  text-align: left; white-space: pre-wrap; word-break: break-word; margin: 10px 0; }
.nyr-report { background: none; border: none; color: #8A81A8; font: 700 .82rem Nunito, sans-serif; cursor: pointer; text-decoration: underline; margin-top: 12px; }
.nyr-check { display: flex; gap: 9px; align-items: flex-start; margin-top: 14px; font-weight: 700; line-height: 1.45; cursor: pointer; }
.nyr-check input { width: 20px; height: 20px; margin-top: 1px; accent-color: #E9B44C; flex: none; }
.nyr-check .sub { display: block; font-weight: 400; color: #B9AEDD; font-size: .86rem; }
.colorpick { display: flex; gap: 22px; justify-content: center; margin: 8px 0 4px; }
.colorpick figure { margin: 0; text-align: center; }
.colorpick button { width: 64px; height: 64px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; position: relative; padding: 0; }
.colorpick button .g-hi { position: absolute; left: 20%; top: 14%; width: 30%; height: 24%; border-radius: 50%; background: rgba(255,255,255,.55); }
.colorpick button.pick-red { background: radial-gradient(circle at 32% 28%, #FF9DAB, #F0566A 55%, #C9334E); }
.colorpick button.pick-green { background: radial-gradient(circle at 32% 28%, #8FE09B, #57C46B 55%, #2F8F46); }
.colorpick button.sel { border-color: #FFF9F0; box-shadow: 0 0 0 3px #7C4DBD; }
.colorpick button:disabled { opacity: .35; cursor: default; }
.colorpick figcaption { margin-top: 6px; font-weight: 800; font-size: .9rem; }
.scratch-wrap { display: flex; justify-content: center; margin: 12px 0; }
.scratch-box { position: relative; width: 300px; max-width: 100%; height: 180px; border-radius: 16px; overflow: hidden; }
.scratch-under { position: absolute; inset: 0; background: #FFF9F0; color: #2A2140; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; padding: 12px; text-align: center; }
.scratch-under .luck-month { font-family: Fraunces, Georgia, serif; font-size: 2rem; font-weight: 700; color: #7C4DBD; }
.scratch-under .luck-line { color: #5C5470; font-size: .9rem; line-height: 1.45; }
.scratch-box canvas { position: absolute; inset: 0; touch-action: none; cursor: pointer; }
.story-wrap { display: flex; justify-content: center; }
.story-wrap canvas { width: min(270px, 80vw); height: auto; border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }

/* ---------- toast / burst / sparkle ---------- */
.nyr-toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 16px); background: #FFF9F0; color: #2A2140;
  border-radius: 999px; padding: 11px 20px; font-weight: 800; box-shadow: 0 10px 28px rgba(0,0,0,.4); z-index: 80;
  opacity: 0; transition: opacity .3s, transform .3s; max-width: 92vw; text-align: center; }
.nyr-toast.show { opacity: 1; transform: translate(-50%, 0); }
.burst-p { position: fixed; width: 8px; height: 8px; border-radius: 50%; pointer-events: none; z-index: 90; }
.nyr-sparkle { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.shake { animation: nyr-shake .5s; }
@keyframes nyr-shake { 0%,100% { transform: translate(-50%,-50%); } 20% { transform: translate(calc(-50% - 5px),-50%); } 40% { transform: translate(calc(-50% + 5px),-50%); } 60% { transform: translate(calc(-50% - 4px),-50%); } 80% { transform: translate(calc(-50% + 4px),-50%); } }

@media (max-width: 640px) {
  .nyr-hero { grid-template-columns: 1fr; }
  .nyr-cards { grid-template-columns: 1fr; }
  .nyr-h1 { font-size: 1.5rem; }
  .nyr-bunch-title { font-size: 1.55rem; }
  .nyr-sharebar-link { max-width: 170px; }
}
