:root {
  --paper: #f0f2eb;
  --ink: #111111;
  --line: 1px solid var(--ink);
  --radius: 16px;
  --sans: Inter, "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --mono: "Azeret Mono", "Space Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
}

button,
textarea,
input {
  font: inherit;
  color: inherit;
  accent-color: var(--ink);
}

button {
  background: transparent;
  border: 0;
  cursor: pointer;
  text-transform: uppercase;
}

button:focus,
textarea:focus,
input:focus,
.dial:focus {
  outline: 0;
}

button:focus-visible,
input:focus-visible,
.dial:focus-visible {
  box-shadow: inset 0 0 0 2px var(--ink);
}

.device-shell {
  width: min(100%, 470px);
  min-height: 100vh;
  margin: 0 auto;
  border-left: var(--line);
  border-right: var(--line);
  background: var(--paper);
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 24px 22px 118px;
}

.screen.is-active {
  display: block;
}

.status-row,
.top-nav,
.entry-header,
.section-head,
.control-row > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-time,
.entry-header time,
.main-clock,
.sub-readout,
.spec-item strong,
.dial-meta output,
.dial-face strong,
.log-list time,
.log-list p,
.control-row output,
textarea {
  font-family: var(--mono);
}

.status-time {
  font-size: 26px;
}

.system-icons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.signal-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 21px;
}

.signal-bars i {
  display: block;
  width: 5px;
  background: var(--ink);
}

.signal-bars i:nth-child(1) { height: 7px; }
.signal-bars i:nth-child(2) { height: 11px; }
.signal-bars i:nth-child(3) { height: 16px; }
.signal-bars i:nth-child(4) { height: 21px; }

.wifi-icon {
  width: 25px;
  height: 18px;
  border: 5px solid var(--ink);
  border-left-color: transparent;
  border-right-color: transparent;
  border-bottom: 0;
  border-radius: 25px 25px 0 0;
  position: relative;
}

.wifi-icon::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: -5px;
  width: 8px;
  height: 8px;
  background: var(--ink);
  border-radius: 50%;
}

.battery-icon {
  width: 42px;
  height: 22px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  padding: 3px;
  position: relative;
}

.battery-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 6px;
  width: 3px;
  height: 8px;
  border: var(--line);
  border-left: 0;
}

.battery-icon i {
  display: block;
  height: 100%;
  width: 76%;
  background: var(--ink);
}

.top-nav {
  margin-top: 34px;
}

h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(48px, 13vw, 66px);
  font-weight: 400;
  line-height: 0.95;
  text-transform: none;
}

.menu-button {
  width: 48px;
  height: 48px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.menu-button span {
  display: block;
  height: 2px;
  background: var(--ink);
}

.tab-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 32px;
  border-bottom: var(--line);
}

.tab {
  min-height: 36px;
  padding: 0 2px 12px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  border-bottom: 5px solid transparent;
}

.tab.is-selected {
  border-bottom-color: var(--ink);
}

.live-panel {
  margin-top: 28px;
  border: var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.clock-block {
  padding: 20px 20px 16px;
  border-bottom: var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.main-clock {
  display: block;
  font-size: clamp(48px, 15vw, 70px);
  line-height: 1;
}

.sub-readout {
  margin: 8px 0 0;
  font-size: 13px;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.spec-item {
  min-width: 0;
  padding: 16px 10px;
  border-right: var(--line);
  text-align: center;
}

.spec-item:last-child {
  border-right: 0;
}

.spec-item p {
  margin: 8px 0 2px;
  font-size: 10px;
  font-weight: 800;
}

.spec-item strong {
  display: block;
  font-size: clamp(16px, 5vw, 24px);
  font-weight: 400;
  white-space: nowrap;
}

.wire {
  display: block;
  margin: 0 auto;
  position: relative;
}

.sun-wire {
  width: 28px;
  height: 28px;
  border: var(--line);
  border-radius: 50%;
}

.sun-wire::before,
.sun-wire::after {
  content: "";
  position: absolute;
  inset: -7px 12px;
  border-left: var(--line);
}

.sun-wire::after {
  transform: rotate(90deg);
}

.drop-wire {
  width: 22px;
  height: 30px;
  border: var(--line);
  border-radius: 50% 50% 55% 55%;
  transform: rotate(45deg);
}

.wind-wire {
  width: 34px;
  height: 24px;
  border-top: var(--line);
  border-bottom: var(--line);
}

.wind-wire::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 11px;
  width: 28px;
  border-top: var(--line);
}

.dial-panel {
  margin-top: 18px;
  border: var(--line);
  border-radius: var(--radius);
  padding: 18px 14px 22px;
}

.dial-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 6px 12px;
}

.dial-meta output {
  font-size: 18px;
}

.dial {
  --angle: 232deg;
  --pointer-distance: -122px;
  width: min(100%, 338px);
  aspect-ratio: 1;
  margin: 0 auto;
  position: relative;
  border-radius: 50%;
  touch-action: none;
}

.tick-ring {
  position: absolute;
  inset: 0;
}

.tick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 18px;
  margin-left: -1px;
  margin-top: -50%;
  background: var(--ink);
  transform-origin: 1px calc(50% - -151px);
}

.tick.is-major {
  height: 27px;
  width: 3px;
}

.dial-face {
  position: absolute;
  inset: 48px;
  border: var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
}

.dial-pointer {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: var(--ink);
  transform: rotate(var(--angle)) translateY(var(--pointer-distance));
  transform-origin: 50% 50%;
}

.dial-date {
  font-family: var(--mono);
  font-size: 15px;
}

.dial-face strong {
  font-size: clamp(52px, 17vw, 72px);
  font-weight: 400;
  line-height: 1;
}

.dial-face em {
  font-family: var(--mono);
  font-size: 14px;
  font-style: normal;
}

.record-button,
.save-button {
  width: 100%;
  min-height: 66px;
  margin-top: 18px;
  border: var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 800;
  background: var(--ink);
  color: var(--paper);
}

.record-button:active,
.save-button:active {
  background: var(--paper);
  color: var(--ink);
}

.log-panel {
  margin-top: 18px;
  border-top: var(--line);
}

.section-head {
  min-height: 46px;
  border-bottom: var(--line);
}

.section-head h2,
.metadata-panel h2,
.control-row h2,
.weather-control h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.section-head span {
  font-family: var(--mono);
  font-size: 13px;
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.log-list li {
  display: grid;
  grid-template-columns: 58px 1fr 52px;
  align-items: center;
  min-height: 54px;
  border-bottom: var(--line);
  gap: 10px;
}

.log-list time {
  font-size: 13px;
}

.log-list p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.mini-switch {
  justify-self: end;
  width: 45px;
  height: 24px;
  border: var(--line);
  border-radius: 999px;
  padding: 2px;
}

.mini-switch::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
}

.mini-switch.is-on::after {
  transform: translateX(19px);
}

.entry-header {
  gap: 14px;
}

.back-button {
  font-family: var(--mono);
  font-size: clamp(30px, 9vw, 48px);
  line-height: 1;
  text-align: left;
  text-transform: none;
}

.entry-header time {
  flex: 0 0 auto;
  font-size: 15px;
}

.entry-body {
  margin-top: 36px;
}

textarea {
  display: block;
  width: 100%;
  min-height: 330px;
  margin-top: 10px;
  padding: 18px;
  resize: vertical;
  border: var(--line);
  border-radius: var(--radius);
  background: transparent;
  font-size: 18px;
  line-height: 1.55;
  outline: 0;
}

textarea:focus {
  border-width: 2px;
}

textarea::placeholder {
  color: var(--ink);
  opacity: 0.52;
}

.metadata-panel {
  margin-top: 18px;
  border: var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.control-row,
.weather-control {
  padding: 18px;
}

.control-row {
  border-bottom: var(--line);
  display: grid;
  gap: 16px;
}

.control-row output {
  font-size: 28px;
}

.range-frame {
  position: relative;
  width: 100%;
  height: 28px;
}

.range-frame span {
  position: absolute;
  left: 1px;
  top: 5px;
  width: var(--mood, 68%);
  max-width: calc(100% - 2px);
  height: 18px;
  border-radius: 999px;
  background: var(--ink);
  pointer-events: none;
}

input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 28px;
  appearance: none;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 18px;
  border: var(--line);
  border-radius: 999px;
  background: transparent;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -6px;
  border: var(--line);
  border-radius: 50%;
  background: var(--paper);
}

input[type="range"]::-moz-range-track {
  height: 18px;
  border: var(--line);
  border-radius: 999px;
  background: transparent;
}

input[type="range"]::-moz-range-progress {
  height: 18px;
  background: var(--ink);
  border-radius: 999px;
}

input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: var(--line);
  border-radius: 50%;
  background: var(--paper);
}

.pill-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.weather-pill {
  min-height: 46px;
  border: var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
}

.weather-pill.is-selected {
  background: var(--ink);
  color: var(--paper);
}

.save-button {
  position: sticky;
  bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.progress-circle {
  width: 26px;
  height: 26px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: none;
}

.save-button.is-loading .progress-circle {
  display: inline-block;
  animation: progress-turn 0.8s steps(12) infinite;
}

@keyframes progress-turn {
  to { transform: rotate(360deg); }
}

@media (min-width: 760px) {
  body {
    padding: 26px;
  }

  .device-shell {
    min-height: calc(100vh - 52px);
    border: var(--line);
    border-radius: 34px;
    overflow: hidden;
  }

  .screen {
    min-height: calc(100vh - 52px);
    padding: 36px 34px 126px;
  }
}

@media (max-width: 380px) {
  .screen {
    padding-left: 16px;
    padding-right: 16px;
  }

  .log-list {
    font-size: 12px;
  }

  .dial-face {
    inset: 42px;
  }

  .dial-pointer {
    transform: rotate(var(--angle)) translateY(var(--pointer-distance));
  }

  .dial {
    --pointer-distance: -109px;
  }
}
