:root {
  color-scheme: light;
  --bg: #f7fbff;
  --ink: #183247;
  --muted: #6a8192;
  --line: #d9e7ee;
  --panel: rgba(255, 255, 255, 0.86);
  --water: #bfeaf0;
  --teal: #18a7a5;
  --coral: #ff7e67;
  --gold: #f9c74f;
  --shadow: 0 18px 48px rgba(24, 50, 71, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(191, 234, 240, 0.54), transparent 28rem),
    linear-gradient(180deg, #f7fbff 0%, #eef8f7 48%, #fff8f2 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 16px;
  align-items: center;
  min-height: 178px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(38px, 10vw, 68px);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.summary {
  max-width: 34rem;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.fish-bowl {
  position: relative;
  width: 128px;
  aspect-ratio: 1;
  border: 2px solid rgba(24, 167, 165, 0.18);
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(191, 234, 240, 0.65), rgba(255, 255, 255, 0.72));
  box-shadow: inset 0 -18px 28px rgba(24, 167, 165, 0.1), var(--shadow);
  overflow: hidden;
}

.fish {
  position: absolute;
  width: 44px;
  height: 25px;
  border-radius: 56% 44% 48% 52%;
}

.fish::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 6px;
  border-right: 15px solid currentColor;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.fish::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #183247;
}

.fish-one {
  right: 24px;
  top: 42px;
  color: var(--coral);
  background: var(--coral);
}

.fish-two {
  right: 54px;
  top: 76px;
  color: var(--gold);
  background: var(--gold);
  transform: scale(0.74) rotate(180deg);
}

.bubble {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(24, 167, 165, 0.34);
  border-radius: 50%;
}

.b1 {
  left: 30px;
  top: 28px;
}

.b2 {
  left: 46px;
  top: 54px;
  width: 7px;
  height: 7px;
}

.quick-panel,
.panel,
.stat-card {
  border: 1px solid rgba(217, 231, 238, 0.84);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.quick-panel {
  padding: 18px;
}

.primary-action {
  display: flex;
  width: 100%;
  min-height: 78px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), #4db8d6);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 16px 30px rgba(24, 167, 165, 0.26);
}

.primary-action.waking {
  background: linear-gradient(135deg, var(--coral), #ffae63);
}

#toggle-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-size: 28px;
}

.active-note,
.form-message {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.stat-card {
  padding: 14px;
}

.stat-card span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  font-size: 22px;
  letter-spacing: 0;
}

.panel {
  margin-top: 14px;
  padding: 16px;
}

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

.segmented {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  min-width: 116px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef7f7;
}

.segment {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segment.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(24, 50, 71, 0.1);
}

#sleep-chart {
  display: block;
  width: 100%;
  min-height: 240px;
}

.manual-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input[type="datetime-local"] {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.secondary-action {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 0 18px;
  font-weight: 800;
}

.toolbar {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
}

.import-button input {
  display: none;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 13px;
}

td {
  font-size: 15px;
}

.delete-row {
  border: 0;
  background: transparent;
  color: var(--coral);
  font-weight: 800;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 680px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 94px;
    min-height: 154px;
  }

  .fish-bowl {
    width: 94px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .manual-form {
    grid-template-columns: 1fr;
  }

  .primary-action {
    min-height: 74px;
    font-size: 18px;
  }
}
