:root {
  color-scheme: light;
  --bg: #f6f1e8;
  --paper: #fffaf1;
  --ink: #1f2722;
  --muted: #657069;
  --line: #d9d0c1;
  --accent: #146c64;
  --accent-dark: #0d4d48;
  --warm: #b45f31;
  --soft: #f0e8d9;
  --shadow: 0 18px 42px rgba(47, 38, 25, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(20, 108, 100, 0.06), transparent 34%),
    linear-gradient(300deg, rgba(180, 95, 49, 0.08), transparent 44%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
.import-button {
  font: inherit;
}

.login-shell,
.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(340px, 0.82fr);
  gap: 24px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.login-panel,
.entry-pane,
.history-pane {
  background: rgba(255, 250, 241, 0.92);
  border: 1px solid rgba(217, 208, 193, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  display: grid;
  gap: 18px;
  max-width: 520px;
  padding: 34px;
  width: 100%;
}

.entry-pane {
  padding: 38px;
}

.history-pane {
  align-self: start;
  max-height: calc(100vh - 64px);
  overflow: auto;
  padding: 24px;
  position: sticky;
  top: 32px;
}

.masthead {
  margin-bottom: 26px;
}

.eyebrow {
  color: var(--warm);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.06;
  margin-bottom: 16px;
}

h2 {
  font-size: 1.45rem;
  margin-bottom: 0;
}

.subtitle {
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.7;
  max-width: 720px;
}

.auth-panel,
.entry-form {
  display: grid;
  gap: 18px;
}

.auth-panel {
  background: var(--soft);
  border: 1px solid #ded3bf;
  border-radius: 8px;
  margin-bottom: 24px;
  padding: 18px 20px;
}

.auth-panel h2 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.auth-panel p {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0;
}

.token-actions,
.focus-actions {
  display: flex;
  gap: 10px;
}

.focus-actions {
  flex-wrap: wrap;
}

#work-timer {
  color: var(--accent-dark);
  font-weight: 800;
  margin: 0;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  font-weight: 800;
}

.date-row {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(180px, 260px) 1fr;
}

#writing-progress {
  color: var(--accent-dark);
  font-weight: 800;
  margin: 0 0 13px;
  text-align: right;
}

.prompt-block {
  background: rgba(255, 253, 248, 0.7);
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 10px;
  padding: 18px;
}

.prompt-block span {
  align-items: center;
  display: flex;
  gap: 10px;
}

.prompt-block b {
  align-items: center;
  background: #e4f0eb;
  border: 1px solid #c5ddd4;
  border-radius: 999px;
  color: var(--accent-dark);
  display: inline-flex;
  font-size: 0.78rem;
  height: 30px;
  justify-content: center;
  width: 42px;
}

.prompt-block small {
  color: var(--muted);
  line-height: 1.5;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  outline: none;
  padding: 13px 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.prompt-block textarea {
  border-color: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
}

textarea {
  line-height: 1.55;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(20, 108, 100, 0.14);
}

.form-actions {
  align-items: center;
  display: flex;
  gap: 16px;
  min-height: 48px;
}

.commit-note {
  background: #f7f0e3;
  border-left: 4px solid var(--warm);
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.6;
  padding: 14px 16px;
}

.commit-note p {
  margin: 0;
}

button,
.import-button {
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
}

button:hover,
.import-button:hover {
  background: var(--accent-dark);
}

button.secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

button.secondary:hover {
  background: #f2eadb;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

#status {
  color: var(--muted);
  margin: 0;
}

#login-status {
  color: var(--muted);
  margin: 0;
  min-height: 24px;
}

#status.success {
  color: var(--accent-dark);
  font-weight: 800;
}

#status.error,
#login-status.error {
  color: #9b2c2c;
  font-weight: 800;
}

#login-status.success {
  color: var(--accent-dark);
  font-weight: 800;
}

.history-head {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 18px;
}

.local-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 18px;
}

.import-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.count {
  align-items: center;
  background: #eef5f1;
  border: 1px solid #c8ded7;
  border-radius: 8px;
  color: var(--accent-dark);
  display: flex;
  gap: 6px;
  padding: 8px 10px;
}

.count strong {
  font-size: 1.2rem;
}

.entries {
  display: grid;
  gap: 14px;
}

.entry {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

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

.entry time {
  color: var(--warm);
  display: block;
  font-weight: 800;
}

.delete-entry {
  background: transparent;
  border: 1px solid var(--line);
  color: #9b2c2c;
  font-size: 0.82rem;
  min-height: 34px;
  padding: 0 10px;
}

.delete-entry:hover {
  background: #f8e6e0;
}

.entry dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.entry div {
  display: grid;
  gap: 3px;
}

.entry dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.entry dd {
  line-height: 1.5;
  margin: 0;
  overflow-wrap: anywhere;
}

.empty {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 16px 0;
  }

  .entry-pane,
  .history-pane {
    padding: 22px;
  }

  .history-pane {
    max-height: none;
    position: static;
  }

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

  #writing-progress {
    margin: 0;
    text-align: left;
  }
}
