:root {
  color-scheme: light;
  --white: #fff;
  --text: #1e2124;
  --muted: #464c53;
  --divider: #cdd1d5;
  --border: #6d7882;
  --wash: #f4f5f6;
  --primary: #0b50d0;
  --primary-hover: #083891;
  --error: #a32132;
  --success: #237243;
  --radius: .5rem;
  background: var(--white);
  color: var(--text);
  font: 100%/1.5 "Pretendard GOV", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 1.0625rem; word-break: keep-all; }
h1, h2, h3, p, ul { margin: 0; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(1.875rem, 5vw, 2.5rem); }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: wait; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.shell { width: min(46rem, calc(100% - 2rem)); margin-inline: auto; }
.skip-link {
  position: fixed;
  inset: .75rem auto auto .75rem;
  z-index: 1;
  transform: translateY(calc(-100% - 1.5rem));
  padding: .65rem 1rem;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--white);
}
.skip-link:focus { transform: none; }
.site-header { border-bottom: 1px solid var(--divider); }
.topbar, .account, .page-heading, .day-heading, .entry-header, .dialog-heading { display: flex; align-items: center; }
.topbar { min-height: 4rem; padding-block: .375rem; justify-content: space-between; gap: .5rem; }
.brand { font-weight: 700; }
.account { gap: .75rem; flex: none; font-size: .9375rem; }
.button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border-radius: var(--radius);
  padding: .5rem .875rem;
  font-size: .9375rem;
  line-height: 1.25;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}
.button { border: 1px solid var(--border); background: var(--white); color: var(--text); }
.text-button { border: 0; background: transparent; color: var(--primary); }
.button:hover, .text-button:hover { background: var(--wash); }
.primary { border-color: var(--primary); background: var(--primary); color: var(--white); }
.primary:hover { border-color: var(--primary-hover); background: var(--primary-hover); }
.button:disabled, .text-button:disabled { border-color: var(--divider); background: var(--wash); color: var(--muted); }

#loading { margin-block: 2rem; }
.login { max-width: 26rem; margin: clamp(2.5rem, 10vh, 5rem) auto 3rem; }
.login h1 { margin-bottom: 1.25rem; }
.providers { display: grid; gap: .625rem; }
.providers:not(:has(a:not([hidden]))) { display: none; }
.providers .button { min-height: 3rem; }
#link-instruction { color: var(--muted); margin-bottom: 1rem; }
.code-login { margin-top: 1rem; }
.code-login summary { color: var(--primary); font-weight: 700; min-height: 2.75rem; padding-block: .5rem; }
.code-login form { margin-top: .75rem; }
.code-login .primary { width: 100%; margin-top: 1rem; }
fieldset { border: 0; min-width: 0; padding: 0; margin: 0 0 1rem; }
legend, .label { font-weight: 700; padding: 0; }
.choice { display: inline-flex; align-items: center; gap: .375rem; min-height: 2.75rem; margin-right: 1rem; }
.choice input { width: 1.25rem; height: 1.25rem; accent-color: var(--primary); margin: 0; }
.code-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; margin-top: .375rem; }

.page-heading { justify-content: space-between; gap: .75rem; margin: 2.25rem 0 1.25rem; flex-wrap: wrap; }
.page-heading time { display: block; color: var(--muted); margin-top: .375rem; font-size: .9375rem; }
.page-heading .primary { min-height: 3rem; }
#review { padding-bottom: 3rem; }
#return-today { margin: -.75rem 0 .5rem; padding-inline: 0; }
.day-group { border-block-start: 1px solid var(--divider); padding: .875rem 0; }
.day-group:last-child { border-block-end: 1px solid var(--divider); }
.day-heading { gap: .5rem .875rem; flex-wrap: wrap; }
.day-heading time { color: var(--muted); font-size: .9375rem; }
.empty { margin-top: .5rem; color: var(--muted); font-size: .9375rem; }
.entries { list-style: none; padding: 0; margin-top: .625rem; }
.entry { border-left: 2px solid var(--primary); padding-left: .75rem; }
.entry + .entry { margin-top: .875rem; }
.entry.done { border-left-color: var(--success); }
.entry-header { min-height: 2.75rem; justify-content: space-between; gap: .5rem; }
.entry-header h3 { overflow-wrap: anywhere; }
.entry-actions { display: flex; align-items: center; gap: .25rem; flex: none; }
.entry-actions .text-button { padding-inline: .5rem; }
.entry-header .completed { border-color: var(--success); color: var(--success); }
.entry .memo, .entry .memo-preview { margin: .125rem 0 .625rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry .memo-preview { color: var(--muted); }
.material:has(details[open]) .memo-preview { display: none; }
.entry details summary { min-height: 2.75rem; width: fit-content; padding: .5rem .125rem; color: var(--primary); font-weight: 700; font-size: .9375rem; }
audio { max-width: 100%; width: min(20rem, 100%); display: block; }

dialog {
  width: min(30rem, calc(100% - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  padding: clamp(1rem, 4vw, 1.625rem);
  border: 1px solid var(--divider);
  border-radius: .75rem;
  background: var(--white);
  color: var(--text);
}
dialog::backdrop { background: rgb(0 0 0 / 43%); }
.dialog-heading { justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.dialog-heading button { margin-right: -.5rem; }
#entry-date { font-size: .9375rem; color: var(--muted); margin-bottom: 1rem; }
.field { display: grid; gap: .375rem; margin-bottom: 1rem; }
input:not([type="radio"], [type="file"]), textarea {
  width: 100%;
  min-width: 0;
  min-height: 2.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  padding: .5rem .75rem;
}
input[aria-invalid="true"] { box-shadow: inset 0 0 0 1px var(--error); border-color: var(--error); }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 5.75rem; }
.help, #audio-hint { font-size: .875rem; color: var(--muted); }
#audio-hint { margin-top: .375rem; }
.audio-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .375rem; }
.file-button { cursor: pointer; }
.file-button:has(+ .file-input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 3px; }
.file-input { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); }
.audio-preview { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; }
#entry-submit { width: 100%; min-height: 3rem; }
#settings-dialog form + form { border-block-start: 1px solid var(--divider); padding-top: 1rem; margin-top: 1rem; }
#logout { margin-top: .75rem; padding-inline: 0; }
.message { color: var(--muted); font-size: .9375rem; margin-block: .5rem; }
.message.error { color: var(--error); }
#notice { border-left: 2px solid currentColor; padding-left: .625rem; margin-bottom: .75rem; }

@media (max-width: 24rem) {
  .shell { width: calc(100% - 1.5rem); }
  .brand { font-size: .9375rem; }
  .account { gap: .25rem; }
  .account .text-button { padding-inline: .5rem; }
  .page-heading { margin-top: 1.75rem; }
  .page-heading .button, .entry-header .button { padding-inline: .625rem; }
}
