:root {
  color-scheme: light;
  font-family: "Yu Gothic UI", "Hiragino Sans", "Meiryo", system-ui, sans-serif;
  color: #31241d;
  background: #fbf7f0;
  --muted: #746255;
  --line: #eee3d7;
  --orange: #b84322;
  --orange-hover: #9e3519;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #aa4828; outline-offset: 4px; }

.shell { width: min(1100px, calc(100% - 80px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); background: #fffcf7; }
.header-inner { min-height: 73px; display: flex; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; font-weight: 750; text-decoration: none; }
.brand-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: #f8dfcf; color: #a3391c; font-size: 25px; }

.intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-block: 58px 32px; }
.intro h1 { margin: 0; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.25; letter-spacing: -.05em; }
.intro h1 span { color: var(--orange); }
.intro p { margin: 12px 0 0; color: var(--muted); font-size: .98rem; }
.mobile-break { display: none; }
.date-pill { display: flex; align-items: center; gap: 10px; flex: none; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fffaf4; font-size: .84rem; font-weight: 650; }
.calendar-icon { position: relative; width: 15px; height: 14px; border: 1.5px solid var(--orange); border-radius: 3px; }
.calendar-icon::before { content: ""; position: absolute; inset: 3px 0 auto; border-top: 1.5px solid var(--orange); }
.calendar-icon::after { content: ""; position: absolute; top: -3px; left: 3px; width: 1.5px; height: 4px; background: var(--orange); box-shadow: 5px 0 var(--orange); }

.dashboard { display: grid; grid-template-columns: minmax(0, 1.36fr) minmax(0, 1fr); align-items: start; gap: 24px; }
.panel { min-width: 0; padding: 27px; border: 1px solid var(--line); border-radius: 24px; background: #fffefa; box-shadow: 0 8px 24px #63351c09; }
.panel h2 { margin: 0; font-size: 1.32rem; line-height: 1.4; }
.mood-field { min-inline-size: 0; margin: 25px 0 0; padding: 0; border: 0; }
.mood-field legend, .memo-field label { padding: 0; font-size: .91rem; font-weight: 700; }
.mood-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 11px; }
.mood-option { position: relative; min-width: 0; cursor: pointer; }
.mood-option input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.mood-tile {
  display: flex;
  min-height: 92px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  border: 1px solid #ebdfd2;
  border-radius: 13px;
  background: #fffbf6;
  color: #47342a;
  text-align: center;
  font-size: clamp(.69rem, 1.2vw, .85rem);
  font-weight: 700;
}
.mood-option:hover .mood-tile { background: #fff2e8; }
.mood-option input:checked + .mood-tile { background: #fce7d8; border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); color: #802d17; }
.mood-option input:focus-visible + .mood-tile { outline: 3px solid #aa4828; outline-offset: 3px; }

.mood-1 { --face: #f3d2c7; --ink: #793d36; }
.mood-2 { --face: #f7dbc6; --ink: #80482e; }
.mood-3 { --face: #f7e3bd; --ink: #795124; }
.mood-4 { --face: #f6d494; --ink: #754415; }
.mood-5 { --face: #f9c67e; --ink: #783c15; }
.face { position: relative; display: block; flex: none; width: 35px; height: 35px; border-radius: 50%; background: var(--face); color: var(--ink); }
.face::before { content: ""; position: absolute; top: 12px; left: 9px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; box-shadow: 13px 0 currentColor; }
.face::after { content: ""; position: absolute; top: 19px; left: 12px; width: 11px; height: 6px; border: 2px solid currentColor; border-bottom: 0; border-radius: 8px 8px 0 0; }
.mood-2 .face::after { height: 4px; top: 21px; }
.mood-3 .face::after { top: 21px; height: 2px; border: 0; border-radius: 2px; background: currentColor; }
.mood-4 .face::after, .mood-5 .face::after { border: 2px solid currentColor; border-top: 0; border-radius: 0 0 8px 8px; }
.mood-5 .face::after { top: 19px; left: 10px; width: 15px; height: 8px; background: currentColor; }

.memo-field { margin-top: 22px; }
.memo-field label { display: inline-flex; align-items: center; gap: 8px; }
.optional { padding: 2px 7px; border-radius: 5px; background: #f6efe7; color: #695548; font-size: .7rem; font-weight: 650; }
textarea {
  display: block;
  width: 100%;
  min-height: 101px;
  margin-top: 9px;
  padding: 12px 14px;
  border: 1px solid #e8dbcd;
  border-radius: 12px;
  resize: vertical;
  background: #fffbf6;
  color: inherit;
  font-size: 1rem;
  line-height: 1.55;
}
textarea::placeholder { color: #79685c; }
.memo-limit { margin-top: 5px; color: var(--muted); text-align: right; font-size: .76rem; font-variant-numeric: tabular-nums; }
.save-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  margin-top: 14px;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: var(--orange);
  color: #fff;
  font-weight: 750;
}
.save-button:hover { background: var(--orange-hover); }
.save-button span { font-size: 1.25rem; line-height: 1; }

.history-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.count-pill { padding: 4px 10px; border-radius: 999px; background: #f7ecdf; color: #705343; font-size: .79rem; font-weight: 700; }
.status { margin: 0; font-size: .85rem; color: #634329; }
.status:not(:empty) { margin-top: 14px; padding: 9px 11px; border-radius: 8px; background: #faf0e4; }
.status.error { color: #912c20; }
.empty-state { display: grid; justify-items: center; align-content: center; min-height: 336px; margin-top: 16px; padding: 20px; border: 1px dashed #ead8c6; border-radius: 17px; background: #fdf8f1; text-align: center; }
.empty-art { position: relative; display: grid; place-items: center; width: 76px; height: 76px; margin-bottom: 16px; border-radius: 50%; background: #fae8d6; color: #a74425; }
.notebook { position: relative; width: 27px; height: 31px; border: 2px solid; border-radius: 4px; transform: rotate(-12deg); }
.notebook::before { content: ""; position: absolute; inset: 0 auto 0 4px; border-left: 1.5px solid; }
.notebook::after { content: ""; position: absolute; top: 8px; left: 9px; width: 11px; height: 1.5px; background: currentColor; box-shadow: 0 5px currentColor; }
.sparkle { position: absolute; top: 10px; right: 10px; font-size: 20px; }
.empty-state p { margin: 0; }
.empty-state .empty-title { margin-bottom: 7px; font-weight: 750; }
.empty-state p:last-child { color: var(--muted); font-size: .87rem; line-height: 1.7; }
.history-list { display: grid; gap: 10px; padding: 0; margin: 16px 0 0; list-style: none; }
.history-list:empty { margin: 0; }
.record { padding: 12px; border: 1px solid #eee2d5; border-radius: 13px; background: #fffbf6; }
.record-heading { display: flex; align-items: center; gap: 10px; }
.record-details { display: grid; gap: 2px; min-width: 0; flex: 1; }
.record-mood { font-size: .92rem; font-weight: 750; }
.record-date { color: var(--muted); font-size: .77rem; }
.record-memo { margin: 9px 0 0; color: #58473b; font-size: .88rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.delete-button { flex: none; min-height: 44px; padding: 6px 9px; border: 1px solid #eddbcf; border-radius: 8px; color: #9a3e28; background: #fffaf6; font-size: .78rem; font-weight: 700; }
.delete-button:hover { background: #f9e6db; }
.footer { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 27px 0 35px; color: var(--muted); font-size: .8rem; }
.lock-icon { position: relative; width: 12px; height: 9px; margin-top: 4px; border: 1.5px solid; border-radius: 2px; }
.lock-icon::before { content: ""; position: absolute; width: 7px; height: 6px; left: 1px; bottom: 6px; border: 1.5px solid; border-bottom: 0; border-radius: 5px 5px 0 0; }

@media (max-width: 860px) {
  .shell { width: min(620px, calc(100% - 40px)); }
  .intro { padding-top: 40px; }
  .dashboard { grid-template-columns: 1fr; gap: 16px; }
  .empty-state { min-height: 230px; }
}

@media (max-width: 560px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { min-height: 61px; }
  .intro { align-items: start; flex-direction: column; gap: 15px; padding-block: 32px 22px; }
  .mobile-break { display: initial; }
  .panel { border-radius: 18px; padding: 16px; }
  .mood-options { gap: 4px; }
  .mood-tile { min-height: 82px; font-size: .67rem; }
}

@media (max-width: 350px) {
  .mood-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
