/* 夏のやりたいこと30 — 雑誌エディトリアル / 空色とレモン */

:root {
  /* palette: 空色とレモン */
  --sky-1: #eaf7ff;
  --sky-2: #bfe6fb;
  --sky-3: #6cc4ef;
  --sky-4: #2b9fe0;
  --sky-ink: #134b6e;
  --lemon-1: #fff7c2;
  --lemon-2: #ffe65a;
  --lemon-3: #ffd21f;
  --lemon-deep: #e9a400;
  --coral: #ff6b5e;
  --paper: #fffdf4;
  --paper-edge: #f2ecd8;
  --ink: #1d3a4d;
  --ink-soft: #4a6678;
  --line: #d9e6ee;

  --cat-odekake: #2b9fe0;
  --cat-tsukuru: #f0883a;
  --cat-taberu: #e8534b;
  --cat-karada: #36b37e;
  --cat-manabu: #7b6ef0;
  --cat-omoide: #e26fb0;

  --shadow-card: 0 10px 26px -16px rgba(19, 75, 110, 0.55);
  --shadow-pop: 0 18px 40px -18px rgba(19, 75, 110, 0.6);

  --font-display: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "HGS明朝E", serif;
  --font-body: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic",
    "YuGothic", "Noto Sans JP", "Meiryo", system-ui, sans-serif;
  --font-num: "Futura", "Helvetica Neue", "Arial Narrow", "Hiragino Sans",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  line-height: 1.6;
  background-color: var(--sky-1);
  background-image: linear-gradient(
      180deg,
      rgba(234, 247, 255, 0.4),
      rgba(255, 253, 244, 0.85) 40%,
      rgba(255, 253, 244, 0.95)
    ),
    url("assets/background.png");
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
  min-height: 100vh;
}

/* fallback when background image is missing */
body.no-bg {
  background-image: radial-gradient(
      circle at 18% 12%,
      var(--lemon-1) 0,
      transparent 30%
    ),
    radial-gradient(circle at 88% 8%, rgba(108, 196, 239, 0.45) 0, transparent 32%),
    linear-gradient(180deg, var(--sky-2) 0, var(--sky-1) 38%, var(--paper) 100%);
  background-attachment: scroll;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 16px 80px;
}

/* ---------- Masthead ---------- */
.masthead {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: var(--sky-3);
  box-shadow: var(--shadow-card);
  margin-bottom: 18px;
}

.masthead__banner {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 800 / 418;
  object-fit: cover;
}

.masthead__fallback {
  display: none;
  position: relative;
  padding: 38px 24px;
  background: linear-gradient(120deg, var(--sky-4), var(--sky-3) 55%, var(--lemon-3));
  color: #fff;
  text-align: center;
}

.masthead.no-img .masthead__banner {
  display: none;
}
.masthead.no-img .masthead__fallback {
  display: block;
}

.masthead__fallback h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 6vw, 46px);
  letter-spacing: 0.04em;
  text-shadow: 0 2px 0 rgba(19, 75, 110, 0.35), 0 8px 18px rgba(0, 0, 0, 0.25);
}

.masthead__fallback p {
  margin: 6px 0 0;
  font-size: 13px;
  letter-spacing: 0.18em;
}

.masthead__kicker {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 2;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  background: rgba(255, 253, 244, 0.92);
  color: var(--sky-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  padding: 5px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow-card);
}

/* ---------- Editorial intro ---------- */
.intro {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.lede {
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  position: relative;
}

.lede h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 4vw, 30px);
  margin: 0 0 8px;
  line-height: 1.25;
}

.lede .rule {
  height: 4px;
  width: 64px;
  background: var(--lemon-3);
  border-radius: 4px;
  margin: 0 0 12px;
}

.lede p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

/* ---------- Progress dashboard ---------- */
.dash {
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow-card);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}

.ring {
  --pct: 0;
  position: relative;
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
  flex: none;
}

.ring svg {
  transform: rotate(-90deg);
  width: 116px;
  height: 116px;
}

.ring__track {
  fill: none;
  stroke: var(--sky-1);
  stroke-width: 12;
}

.ring__bar {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.ring__center {
  position: absolute;
  text-align: center;
  line-height: 1.05;
}

.ring__num {
  font-family: var(--font-num);
  font-size: 30px;
  font-weight: 800;
  color: var(--sky-4);
}

.ring__den {
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
}

.dash__meta {
  min-width: 0;
}

.rank {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: clamp(18px, 3.4vw, 24px);
  margin: 0 0 6px;
}

.rank__sun {
  font-size: 0.9em;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 10px;
}

.stat {
  background: var(--sky-1);
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--sky-ink);
}

.stat b {
  font-family: var(--font-num);
  font-size: 17px;
  font-weight: 800;
  margin-right: 2px;
}

.dash__bar {
  height: 9px;
  border-radius: 999px;
  background: var(--sky-1);
  overflow: hidden;
}

.dash__bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sky-4), var(--lemon-3));
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Divider ---------- */
.divider {
  margin: 22px 0 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.divider img {
  height: 46px;
  width: auto;
  flex: none;
}

.divider.no-img img {
  display: none;
}

.divider h3 {
  font-family: var(--font-display);
  font-size: clamp(18px, 3.4vw, 24px);
  margin: 0;
  white-space: nowrap;
}

.divider .line {
  flex: 1;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--sky-3) 0,
    var(--sky-3) 8px,
    transparent 8px,
    transparent 14px
  );
  opacity: 0.6;
}

/* ---------- Add form ---------- */
.composer {
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}

.composer__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.composer__head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
}

.composer__head .hint {
  font-size: 12px;
  color: var(--ink-soft);
}

.field-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
  resize: vertical;
  min-height: 44px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--sky-3);
  box-shadow: 0 0 0 3px rgba(108, 196, 239, 0.3);
}

.prio-pick {
  display: flex;
  gap: 6px;
}

.prio-pick button {
  flex: 1;
  font-family: inherit;
  font-size: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 4px;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all 0.15s;
}

.prio-pick button[aria-pressed="true"] {
  border-color: var(--lemon-deep);
  background: var(--lemon-1);
  color: var(--ink);
  font-weight: 700;
}

.composer__foot {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 11px 20px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: linear-gradient(180deg, var(--sky-3), var(--sky-4));
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(43, 159, 224, 0.8);
}

.btn--primary:hover {
  background: linear-gradient(180deg, var(--sky-4), #1f88c6);
}

.btn--lemon {
  background: linear-gradient(180deg, var(--lemon-2), var(--lemon-3));
  color: var(--ink);
  box-shadow: 0 8px 18px -8px rgba(233, 164, 0, 0.8);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px solid var(--line);
}

.btn--ghost:hover {
  background: var(--sky-1);
}

.btn--danger {
  background: #fff;
  color: var(--coral);
  border: 1.5px solid var(--coral);
}

.btn--danger:hover {
  background: var(--coral);
  color: #fff;
}

.btn--sm {
  padding: 7px 12px;
  font-size: 12px;
  border-radius: 10px;
}

.composer__foot .spacer {
  flex: 1;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar .seg {
  display: inline-flex;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: 12px;
  padding: 3px;
  box-shadow: var(--shadow-card);
}

.toolbar .seg button {
  font-family: inherit;
  font-size: 12px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 9px;
  cursor: pointer;
}

.toolbar .seg button[aria-pressed="true"] {
  background: var(--sky-3);
  color: #fff;
  font-weight: 700;
}

.toolbar .spacer {
  flex: 1;
}

/* ---------- Board ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.slot {
  position: relative;
  border-radius: 16px;
  min-height: 158px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s, box-shadow 0.15s;
}

.slot__index {
  position: absolute;
  top: 8px;
  right: 12px;
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 800;
  color: rgba(19, 75, 110, 0.3);
  letter-spacing: 0.04em;
}

/* empty slot */
.slot--empty {
  background: rgba(255, 253, 244, 0.7);
  border: 2px dashed var(--sky-2);
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--sky-4);
  cursor: pointer;
}

.slot--empty:hover {
  background: var(--sky-1);
  transform: translateY(-2px);
}

.slot--empty .plus {
  font-size: 30px;
  line-height: 1;
  font-weight: 300;
}

.slot--empty .lbl {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* filled slot */
.slot--filled {
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-top: 6px solid var(--cat, var(--sky-3));
}

.slot--done {
  background: linear-gradient(180deg, #fffef9, var(--lemon-1));
}

.slot__cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--cat, var(--sky-3));
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 7px;
}

.slot__title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 4px;
  word-break: break-word;
}

.slot--done .slot__title {
  text-decoration: line-through;
  text-decoration-color: rgba(233, 164, 0, 0.6);
  text-decoration-thickness: 2px;
}

.slot__memo {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0 0 6px;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.slot__metarow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: auto;
}

.slot__chip {
  background: var(--sky-1);
  border-radius: 8px;
  padding: 2px 7px;
}

.slot__prio[data-prio="3"] {
  color: var(--coral);
  font-weight: 700;
}

.slot__actions {
  display: flex;
  gap: 5px;
  margin-top: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.iconbtn {
  font-family: inherit;
  font-size: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 9px;
  padding: 5px 8px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.13s;
}

.iconbtn:hover {
  border-color: var(--sky-3);
  color: var(--sky-4);
}

.iconbtn:disabled {
  opacity: 0.35;
  cursor: default;
}

.iconbtn--done {
  margin-right: auto;
  border-color: var(--lemon-deep);
  background: var(--lemon-1);
  color: var(--ink);
  font-weight: 700;
}

.iconbtn--done:hover {
  background: var(--lemon-2);
  color: var(--ink);
}

.iconbtn--undo {
  margin-right: auto;
}

/* stamp on done */
.slot__stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 78px;
  height: 78px;
  transform: translate(-50%, -55%) rotate(-12deg);
  pointer-events: none;
  background-image: url("assets/stamp-set.png");
  background-repeat: no-repeat;
  background-size: 300% 300%;
  background-position: 0% 0%; /* top-left = red check stamp */
  filter: drop-shadow(0 4px 8px rgba(19, 75, 110, 0.3));
  opacity: 0.92;
}

/* CSS fallback stamp if image missing */
.no-stamp-img .slot__stamp {
  background-image: none;
  border: 5px solid var(--coral);
  border-radius: 50%;
  width: 64px;
  height: 64px;
}

.no-stamp-img .slot__stamp::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--coral);
  font-size: 38px;
  font-weight: 900;
}

@keyframes stampIn {
  0% {
    transform: translate(-50%, -55%) rotate(-12deg) scale(2.4);
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
  75% {
    transform: translate(-50%, -55%) rotate(-12deg) scale(0.92);
  }
  100% {
    transform: translate(-50%, -55%) rotate(-12deg) scale(1);
    opacity: 0.92;
  }
}

.slot__stamp.is-pop {
  animation: stampIn 0.5s cubic-bezier(0.18, 1.3, 0.4, 1) both;
}

@keyframes slotPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 210, 31, 0.7);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(255, 210, 31, 0);
  }
}

.slot.is-celebrate {
  animation: slotPulse 0.6s ease-out;
}

/* ---------- Empty board state ---------- */
.board-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 16px;
  color: var(--ink-soft);
}

/* ---------- Modal ---------- */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(19, 75, 110, 0.45);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 60;
}

.modal-back.is-open {
  display: flex;
}

.modal {
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow-pop);
  max-width: 460px;
  width: 100%;
  padding: 22px;
  animation: modalIn 0.22s ease-out both;
}

@keyframes modalIn {
  from {
    transform: translateY(12px) scale(0.98);
    opacity: 0;
  }
}

.modal h3 {
  font-family: var(--font-display);
  margin: 0 0 8px;
  font-size: 20px;
}

.modal p {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 14px;
}

.modal__foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal .field-grid {
  margin-bottom: 8px;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
  width: min(92vw, 380px);
}

.toast {
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  padding: 11px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  display: flex;
  align-items: center;
  gap: 9px;
  animation: toastIn 0.25s ease-out both;
}

.toast--ok {
  background: linear-gradient(120deg, var(--sky-4), #1f88c6);
}
.toast--warn {
  background: linear-gradient(120deg, var(--lemon-deep), #c98a00);
}
.toast--info {
  background: var(--ink);
}

.toast.is-out {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
}
@keyframes toastOut {
  to {
    transform: translateY(16px);
    opacity: 0;
  }
}

/* ---------- Footer ---------- */
.foot {
  margin-top: 30px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
}

.foot a {
  color: var(--sky-4);
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .intro {
    grid-template-columns: 1fr;
  }
  .dash {
    grid-template-columns: auto 1fr;
  }
}

@media (max-width: 540px) {
  .wrap {
    padding: 12px 12px 70px;
  }
  .field-grid {
    grid-template-columns: 1fr;
  }
  .board {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }
  .dash {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .ring {
    margin: 0 auto;
  }
  .stats,
  .rank {
    justify-content: center;
  }
  .composer__foot {
    flex-wrap: wrap;
  }
  .composer__foot .btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
