:root {
  --paper: #f6f3ee;
  --card: #fffdf9;
  --pressed: #e9e3d9;
  --ink: #2f2c28;
  --ink-soft: #6f6a62;
  --line: #ddd6cb;
  --toast: #3a3631;
  --toast-ink: #f6f3ee;
  --tabs-height: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1f1d1a;
    --card: #2a2824;
    --pressed: #3a3731;
    --ink: #ece7df;
    --ink-soft: #a8a297;
    --line: #3d3a34;
    --toast: #ece7df;
    --toast-ink: #2a2824;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
  cursor: pointer;
}

.screen {
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + var(--tabs-height) + 16px);
  max-width: 560px;
  margin: 0 auto;
}

/* 残す */
.words {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.word {
  min-height: 54px;
  padding: 4px 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
  line-height: 1.35;
  word-break: keep-all;
  overflow-wrap: anywhere;
  transition: background-color 0.4s ease;
}

.word.wide {
  grid-column: 1 / -1;
  min-height: 64px;
  font-size: 19px;
}

.word.left {
  background: var(--pressed);
  transition: none;
}

/* 見返す */
.day { margin-bottom: 28px; }

.day h2 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
}

.day ul { margin: 0; padding: 0; list-style: none; }

.day li {
  display: flex;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.day time {
  flex: none;
  min-width: 3em;
  text-align: right;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.empty {
  margin-top: 30vh;
  text-align: center;
  color: var(--ink-soft);
}

/* 残したあとの知らせ */
.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + var(--tabs-height) + 12px);
  max-width: 528px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  background: var(--toast);
  color: var(--toast-ink);
  border-radius: 12px;
  font-size: 15px;
}

.toast-undo {
  flex: none;
  min-height: 44px;
  padding: 0 12px;
  background: none;
  border: 1px solid currentColor;
  border-radius: 8px;
  font-size: 15px;
}

/* 画面の切り替え */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.tab {
  flex: 1;
  height: var(--tabs-height);
  background: none;
  border: 0;
  color: var(--ink-soft);
}

.tab[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}
