@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap');

/* Consistent sizing for all elements */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
  color-scheme: light;
  --ink: #111;
  --muted: #777;
  --line: #dedede;
  --paper: #f5f5f3;
  --white: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Manrope, Arial, sans-serif; }
button, input, textarea { font: inherit; }
.shell { width: min(100% - 32px, 760px); margin: 0 auto; padding: 34px 0 24px; }
.topbar, .section-heading, .entries-heading, .entry-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar { margin-bottom: 26px; }
.eyebrow { margin: 0 0 7px; color: var(--muted); font: 500 10px 'DM Mono', monospace; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(28px, 6vw, 42px); line-height: 1.05; letter-spacing: -.055em; }
h2 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 18px; }
.form-panel { padding: 26px; }
.section-heading { margin-bottom: 24px; }
.date-chip { padding: 8px 11px; border: 1px solid var(--line); border-radius: 99px; color: #555; font: 11px 'DM Mono', monospace; white-space: nowrap; }
.field { display: flex; flex-direction: column; gap: 9px; min-width: 0; margin: 0 0 20px; }
.field > span, legend { font-size: 13px; font-weight: 700; }
input[type="date"], input[type="time"], textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); padding: 12px; outline: none; }
input:focus, textarea:focus { border-color: var(--ink); }
.time-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
fieldset { padding: 0; border: 0; }
legend { margin-bottom: 10px; }
.choice-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: grid; place-items: center; min-height: 43px; border: 1px solid var(--line); border-radius: 10px; color: #555; font-size: 13px; transition: .15s ease; }
.choice input:checked + span { background: var(--ink); border-color: var(--ink); color: white; }
.choice input:focus-visible + span { outline: 2px solid #888; outline-offset: 2px; }
.sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 3px; }
.slider-title { display: flex; justify-content: space-between; align-items: center; }
.slider-title output { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: white; font: 12px 'DM Mono', monospace; }
input[type="range"] { width: 100%; accent-color: var(--ink); cursor: pointer; }
.scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.counter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.counter-card { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; }
.counter-label { font-size: 13px; font-weight: 700; }
.counter { display: flex; align-items: center; gap: 13px; font: 14px 'DM Mono', monospace; }
.counter output { min-width: 14px; text-align: center; }
.counter-btn { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; background: white; cursor: pointer; font-size: 18px; line-height: 1; }
.counter-btn:active { background: var(--ink); color: white; }
textarea { resize: vertical; min-height: 76px; }
.button { border: 1px solid var(--ink); border-radius: 99px; padding: 10px 15px; cursor: pointer; font-size: 12px; font-weight: 700; transition: .15s ease; }
.button-primary { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 50px; background: var(--ink); color: white; font-size: 14px; }
.button-primary:hover { background: #333; }
.button-secondary { background: white; color: var(--ink); }
.button-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.button:hover, .counter-btn:hover { border-color: var(--ink); }
.form-note { min-height: 17px; margin: 9px 0 0; color: var(--muted); text-align: center; font-size: 11px; }
.entries-section { margin-top: 36px; }
.entries-heading { margin-bottom: 10px; }
.entries-count, .privacy-note { color: var(--muted); font-size: 11px; }
.entries-count { margin: 0 0 12px; }
.entries-list { display: grid; gap: 10px; }
.empty-state { padding: 28px 16px; border: 1px dashed #c9c9c9; border-radius: 14px; color: var(--muted); text-align: center; font-size: 13px; }
.entry-card { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.entry-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 13px; }
.entry-date { font-size: 14px; font-weight: 800; }
.delete-entry { border: 0; background: transparent; color: #777; cursor: pointer; font-size: 11px; text-decoration: underline; }
.entry-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; }
.metric-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.metric-value { font: 12px 'DM Mono', monospace; overflow-wrap: anywhere; }
.entry-comment { margin: 13px 0 0; padding-top: 11px; border-top: 1px solid #eee; color: #555; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.privacy-note { margin-top: 14px; line-height: 1.6; }
footer { margin-top: 35px; color: #999; text-align: center; font: 9px 'DM Mono', monospace; letter-spacing: .12em; }
footer span { padding: 0 5px; }
@media (max-width: 560px) {
  .shell { width: min(100% - 22px, 480px); padding-top: 22px; }
  .topbar { align-items: flex-start; }
  .topbar .button { max-width: 128px; line-height: 1.35; }
  .form-panel { padding: 18px 14px; border-radius: 15px; }
  .section-heading { margin-bottom: 19px; }
  .time-grid { grid-template-columns: 1fr; gap: 0; }
  .time-grid .field { margin-bottom: 13px; }
  .sliders { grid-template-columns: 1fr; gap: 2px; }
  .counter-grid { gap: 8px; }
  .counter-card { padding: 10px 9px; align-items: flex-start; flex-direction: column; gap: 8px; }
  .counter { width: 100%; justify-content: space-between; }
  .entries-heading { align-items: flex-start; flex-direction: column; }
  .entry-actions { width: 100%; }
  .entry-actions .button { flex: 1; }
  .entry-metrics { grid-template-columns: repeat(2, 1fr); }
  .date-chip { font-size: 10px; }
}

/* Prevent form controls from overflowing their containers */
input,
select,
textarea {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
/* Fix: Safari iOS 18 input overflow */
.field {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.field > input,
.field > textarea {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    flex: 0 1 auto;
}

/* Fix native date/time controls in iOS Safari */
input[type="date"],
input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
    min-inline-size: 0;
    inline-size: 100%;
    max-inline-size: 100%;
}

input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
    min-width: 0;
    text-align: left;
}

/* Prevent fieldsets from expanding the form */
fieldset {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
