:root {
  --ink: #14241f;
  --ink-soft: #3d524a;
  --muted: #6b8078;
  --paper: rgba(247, 244, 236, 0.78);
  --paper-solid: #f7f4ec;
  --sea: #1e6b5c;
  --sea-deep: #13483d;
  --dawn: #c4784a;
  --flame: #d9773a;
  --line: rgba(20, 36, 31, 0.12);
  --ok: #1e6b5c;
  --skip: #8a7360;
  --freeze: #4a7c9b;
  --shadow: 0 24px 60px rgba(18, 40, 34, 0.18);
  --radius: 28px;
  --font-display: "Shippori Mincho", "Hiragino Mincho ProN", serif;
  --font-body: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: #d5e0da;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 80% at 10% -10%, #f3e6d2 0%, transparent 55%),
    radial-gradient(90% 70% at 100% 0%, #9ec4b8 0%, transparent 50%),
    linear-gradient(165deg, #cfdcd6 0%, #e8ebe3 42%, #d7cfc2 100%);
}

.mist {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.45;
  animation: drift 18s ease-in-out infinite alternate;
}

.mist-a {
  width: 70vw;
  height: 70vw;
  top: -10%;
  left: -15%;
  background: #f5efe3;
}

.mist-b {
  width: 60vw;
  height: 60vw;
  right: -20%;
  bottom: 5%;
  background: #a8c9bf;
  animation-duration: 22s;
  animation-direction: alternate-reverse;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(4%, 6%) scale(1.08); }
}

.app {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  min-height: 100dvh;
}

.view[hidden] {
  display: none !important;
}

.view-today.is-active .card {
  animation: rise 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.top {
  text-align: center;
  margin-bottom: 14px;
}

.hud-wrap {
  margin-bottom: 14px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px 8px;
  border-radius: 16px;
  background: rgba(247, 244, 236, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 20px rgba(18, 40, 34, 0.06);
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.hud-item:hover {
  border-color: rgba(30, 107, 92, 0.35);
}

.hud-item:active {
  transform: scale(0.97);
}

.hud-item.is-open {
  border-color: var(--sea);
  box-shadow: 0 8px 20px rgba(30, 107, 92, 0.18);
}

.hud-tip {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(20, 36, 31, 0.9);
  color: var(--paper-solid);
  animation: tipIn 0.2s ease both;
}

.hud-tip[hidden] {
  display: none !important;
}

.hud-tip-title {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.hud-tip-body {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.7;
  opacity: 0.9;
}

@keyframes tipIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hud-label {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.hud-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--sea-deep);
  line-height: 1.1;
}

.hud-unit {
  font-size: 0.65rem;
  color: var(--muted);
}

.goal {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(30, 107, 92, 0.08);
  border: 1px solid rgba(30, 107, 92, 0.12);
}

.goal-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--sea-deep);
  font-weight: 700;
  margin-bottom: 8px;
}

.goal-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(20, 36, 31, 0.08);
  overflow: hidden;
}

.goal-fill {
  height: 100%;
  width: 8%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3d9b86, var(--sea-deep));
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.goal-fill.is-done {
  background: linear-gradient(90deg, var(--flame), #e8a35c);
}

.goal-fill.is-skip {
  background: linear-gradient(90deg, #b49a86, var(--skip));
}

.goal-hint {
  margin: 8px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.memo-preview {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(212, 119, 58, 0.1);
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.date {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.back {
  border: 0;
  background: transparent;
  font-size: 1.25rem;
  color: var(--ink);
  width: 40px;
  height: 40px;
  cursor: pointer;
  border-radius: 50%;
}

.back:active {
  background: rgba(255, 255, 255, 0.35);
}

.spacer {
  width: 40px;
}

.card {
  position: relative;
  background: var(--paper);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-shine {
  position: absolute;
  top: -40%;
  right: -20%;
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), transparent 65%);
  pointer-events: none;
}

.theme {
  position: relative;
  display: inline-block;
  margin: 0 0 14px;
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--sea-deep);
  background: rgba(30, 107, 92, 0.1);
  border-radius: 999px;
  animation: breathe 3.6s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.03); opacity: 1; }
}

.title {
  position: relative;
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 5.5vw, 1.75rem);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0.04em;
}

.body {
  position: relative;
  margin: 0 0 16px;
  font-size: 0.98rem;
  line-height: 1.85;
  color: var(--ink-soft);
  font-weight: 400;
}

.source {
  position: relative;
  margin: 0 0 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--muted);
}

.action-block {
  position: relative;
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(30, 107, 92, 0.07);
  border-radius: 18px;
}

.action-label {
  margin: 0 0 8px;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: var(--sea);
  font-weight: 700;
}

.action {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.7;
  font-weight: 500;
}

.actions {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 10px;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-done {
  color: #f7f4ec;
  background: linear-gradient(160deg, var(--sea) 0%, var(--sea-deep) 100%);
  box-shadow: 0 10px 24px rgba(19, 72, 61, 0.28);
}

.btn-skip {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
}

.status-line {
  margin: 18px 0 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  color: var(--sea-deep);
}

.status-line.is-skip {
  color: var(--skip);
}

.week {
  margin-top: 26px;
  text-align: center;
}

.week-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(20, 36, 31, 0.12);
  transform: scale(0.6);
  opacity: 0;
  animation: pop 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.dot.done {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(30, 107, 92, 0.18);
}

.dot.skip {
  background: var(--skip);
}

.dot.freeze {
  background: var(--freeze);
  box-shadow: 0 0 0 3px rgba(74, 124, 155, 0.18);
}

.dot.miss {
  background: transparent;
  border: 1.5px solid rgba(20, 36, 31, 0.22);
}

.log-item .mark.freeze { background: var(--freeze); }

@keyframes pop {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.totals {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.totals-log {
  text-align: center;
  margin-bottom: 18px;
}

.bottom-nav {
  margin-top: 22px;
  text-align: center;
}

.linkish {
  border: 0;
  background: transparent;
  color: var(--sea-deep);
  font-family: inherit;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  padding: 8px 12px;
}

.disclaimer {
  margin: 28px 8px 0;
  font-size: 0.68rem;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}

.remind-card {
  margin-top: 22px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(247, 244, 236, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.remind-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.remind-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.remind-sub {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.remind-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.remind-time-label {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

#remind-time {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 1rem;
  background: #fffdf8;
  color: var(--ink);
}

.remind-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.remind-actions .btn {
  padding: 12px 8px;
  font-size: 0.82rem;
}

.remind-note {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.55;
  color: var(--muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-ui {
  position: absolute;
  inset: 0;
  background: rgba(20, 36, 31, 0.18);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.switch-ui::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.switch input:checked + .switch-ui {
  background: var(--sea);
}

.switch input:checked + .switch-ui::before {
  transform: translateX(20px);
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: var(--paper);
  border-radius: 18px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 8px 24px rgba(18, 40, 34, 0.06);
}

.log-item:disabled {
  cursor: default;
  opacity: 0.72;
}

.log-item .mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.log-item .mark.done { background: var(--ok); }
.log-item .mark.skip { background: var(--skip); }
.log-item .mark.miss {
  background: transparent;
  border: 1.5px solid rgba(20, 36, 31, 0.25);
}

.log-item .meta {
  flex: 1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.log-item .label {
  color: var(--muted);
  font-size: 0.82rem;
}

.log-item .chev {
  color: var(--muted);
}

.card.celebrate {
  animation: celebrate 0.7s ease;
}

@keyframes celebrate {
  0% { transform: scale(1); }
  40% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  z-index: 20;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper-solid);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.sheet,
.celebrate-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
  background: rgba(18, 32, 28, 0.45);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.sheet.is-on,
.celebrate-overlay.is-on {
  opacity: 1;
}

.celebrate-overlay {
  align-items: center;
}

.sheet[hidden],
.celebrate-overlay[hidden] {
  display: none !important;
}

.sheet-panel,
.celebrate-card {
  width: min(400px, 100%);
  background: var(--paper-solid);
  border-radius: 28px 28px 22px 22px;
  padding: 24px 22px 22px;
  box-shadow: 0 24px 60px rgba(10, 24, 20, 0.28);
  transform: translateY(16px);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet.is-on .sheet-panel,
.celebrate-overlay.is-on .celebrate-card {
  transform: translateY(0);
}

.celebrate-card {
  border-radius: 28px;
  text-align: center;
  padding: 32px 24px 24px;
}

.sheet-kicker,
.celebrate-kicker {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--sea);
  font-weight: 700;
}

.sheet-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.45;
}

#memo-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: none;
  background: #fffdf8;
  color: var(--ink);
}

#memo-input:focus {
  outline: 2px solid rgba(30, 107, 92, 0.35);
  border-color: transparent;
}

.sheet-note {
  margin: 8px 0 16px;
  font-size: 0.72rem;
  color: var(--muted);
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 10px;
}

.celebrate-streak {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--flame);
  letter-spacing: 0.04em;
}

.celebrate-xp {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--sea-deep);
}

.celebrate-level {
  margin: 0 0 22px;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .mist,
  .theme,
  .view-today.is-active .card,
  .dot,
  .card.celebrate {
    animation: none !important;
  }
  .dot {
    opacity: 1;
    transform: scale(1);
  }
  .sheet-panel,
  .celebrate-card,
  .goal-fill {
    transition: none !important;
  }
}
