:root {
  --cream: #fffaf2;
  --paper: #fffdf8;
  --ink: #2d241e;
  --brown: #795442;
  --muted: #9b8b80;
  --line: #ead9ca;
  --pink: #e9aaa5;
  --rose: #a65f55;
  --peach: #fff0e4;
  --green: #a8b897;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(233, 170, 165, 0.2), transparent 34%),
    linear-gradient(180deg, #fffdf8 0%, #fff7ed 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.phone-shell {
  position: relative;
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background: rgba(255, 253, 248, 0.94);
}

.app-header {
  position: relative;
  padding: 38px 22px 24px;
  border-bottom: 1px solid var(--line);
}

.app-header > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--rose);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  color: var(--brown);
  font-size: 29px;
  line-height: 1.2;
  letter-spacing: 0;
}

.lead {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.app-main {
  display: grid;
  gap: 16px;
  padding: 18px 18px 88px;
}

.add-card,
.summary-card,
.list-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 10px 26px rgba(127, 89, 72, 0.08);
}

.add-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.open-add-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid #e8b2aa;
  border-radius: 999px;
  background: #fff6f0;
  color: #9d554a;
  font-size: 15px;
  font-weight: 650;
}

.add-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.add-title-row h2 {
  font-size: 18px;
}

.text-button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.category-choice-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.category-choice {
  min-height: 48px;
  border: 1px solid #e7d1c3;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff8f2, #fffdf9);
  color: var(--brown);
  font-weight: 650;
}

.add-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--brown);
  font-size: 14px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid #e4d4c8;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input {
  padding: 0 14px;
}

input::placeholder {
  color: rgba(45, 36, 30, 0.32);
}

textarea::placeholder {
  color: rgba(45, 36, 30, 0.28);
}

select {
  padding: 0 12px;
}

textarea {
  min-height: 74px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.55;
}

.add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 10px;
}

.add-row.single {
  grid-template-columns: 1fr;
}

button {
  border: 0;
  cursor: pointer;
}

.add-row button,
.primary-action {
  min-height: 44px;
  border: 1px solid #e8b2aa;
  border-radius: 999px;
  background: #fff6f0;
  color: #9d554a;
  font-weight: 650;
}

.summary-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 13px;
}

.summary-card div {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff5ef, #fffdfa);
}

.summary-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.summary-card strong {
  color: var(--brown);
  font-size: 24px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
}

.tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.tab.active {
  border-color: #e6c9bc;
  background: #fff8f2;
  color: var(--brown);
  box-shadow: 0 6px 14px rgba(127, 89, 72, 0.08);
}

.list-card {
  padding: 16px;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

h2 {
  margin: 0;
  color: var(--brown);
  font-size: 24px;
  letter-spacing: 0;
}

.soft-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #dbc8ba;
  border-radius: 999px;
  background: #fffdfa;
  color: var(--brown);
  font-size: 13px;
  font-weight: 650;
}

.items {
  display: grid;
  gap: 7px;
}

.item-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 36px 20px 24px;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 7px 6px 7px 8px;
  border-radius: 14px;
  background: rgba(255, 250, 244, 0.82);
}

.check {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1.5px solid #ad8c79;
  border-radius: 7px;
  color: #fff;
  background: #fff;
  font-weight: 700;
}

.item-row.done .check {
  border-color: var(--green);
  background: var(--green);
}

.item-text {
  min-width: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.item-name {
  display: block;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.45;
}

.item-category {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.item-note {
  display: block;
  margin-top: 3px;
  color: rgba(121, 84, 66, 0.68);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

.item-row.done .item-name {
  color: rgba(45, 36, 30, 0.45);
  text-decoration: line-through;
}

.item-row.done .item-note {
  color: rgba(45, 36, 30, 0.34);
}

.note-button {
  min-height: 24px;
  padding: 0 6px;
  border: 1px solid rgba(221, 190, 174, 0.62);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: rgba(121, 84, 66, 0.7);
  font-size: 11px;
  font-weight: 500;
}

.note-button.has-note {
  border-color: rgba(166, 95, 85, 0.32);
  background: rgba(255, 240, 228, 0.62);
  color: #9b5f4f;
}

.delete-button {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: transparent;
  color: #b99f91;
  font-size: 16px;
}

.reorder-handle {
  position: relative;
  width: 20px;
  min-height: 28px;
  display: grid;
  place-items: center;
  align-self: center;
  border-radius: 8px;
  color: #b79d8d;
  cursor: grab;
  touch-action: none;
}

.reorder-handle::before {
  content: "";
  width: 4px;
  height: 20px;
  border-radius: 999px;
  background: radial-gradient(circle, currentColor 1.5px, transparent 2px) center 2px / 4px 7px repeat-y;
  opacity: 0.56;
}

.reorder-handle::after {
  content: "長押しで上下に移動";
  position: absolute;
  right: -4px;
  bottom: calc(100% + 8px);
  z-index: 4;
  width: max-content;
  max-width: 156px;
  padding: 7px 9px;
  border: 1px solid rgba(221, 190, 174, 0.78);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.96);
  color: var(--brown);
  font-size: 11px;
  line-height: 1.3;
  box-shadow: 0 8px 20px rgba(127, 89, 72, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: 0.16s ease;
}

.reorder-handle:hover::after,
.reorder-handle:focus-visible::after,
.reorder-handle:active::after {
  opacity: 1;
  transform: translateY(0);
}

.is-reordering {
  user-select: none;
}

.dragging-item {
  opacity: 0.64;
}

.drop-before {
  box-shadow: inset 0 3px 0 rgba(166, 95, 85, 0.38);
}

.drop-after {
  box-shadow: inset 0 -3px 0 rgba(166, 95, 85, 0.38);
}

.note-editor-row {
  display: grid;
  gap: 8px;
  margin: -2px 0 5px 38px;
  padding: 10px;
  border: 1px dashed rgba(221, 190, 174, 0.72);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.82);
}

.note-input {
  min-height: 68px;
  border-radius: 13px;
  font-size: 13px;
}

.note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.note-save,
.note-close {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.note-save {
  border: 1px solid #e8b2aa;
  background: #fff6f0;
  color: #9d554a;
}

.note-close {
  border: 1px solid rgba(221, 190, 174, 0.7);
  background: transparent;
  color: var(--muted);
}

.category-add-button {
  justify-self: end;
  width: auto;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1.5px dashed rgba(180, 114, 91, 0.42);
  border-radius: 999px;
  background: rgba(255, 250, 244, 0.72);
  color: #9b5f4f;
  font-size: 13px;
  font-weight: 650;
}

.empty {
  margin: 0;
  padding: 28px 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.app-footer {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(100%, 430px);
  height: 74px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 5;
  transform: translateX(-50%) translateY(18px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(71, 52, 42, 0.9);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  transition: 0.2s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
