/* ── Google Sans (display / headings) ── */
@font-face {
  font-family: 'Google Sans';
  font-weight: 400; font-display: swap;
  src: url('../../fonts/GoogleSans_17pt-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Google Sans';
  font-weight: 500; font-display: swap;
  src: url('../../fonts/GoogleSans_17pt-Medium.ttf') format('truetype');
}
@font-face {
  font-family: 'Google Sans';
  font-weight: 700; font-display: swap;
  src: url('../../fonts/GoogleSans_17pt-Bold.ttf') format('truetype');
}

/* ── Google Sans Text (body / controls) ── */
@font-face {
  font-family: 'Google Sans Text';
  font-weight: 400; font-display: swap;
  src: url('../../fonts/GoogleSans-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Google Sans Text';
  font-weight: 500; font-display: swap;
  src: url('../../fonts/GoogleSans-Medium.ttf') format('truetype');
}
@font-face {
  font-family: 'Google Sans Text';
  font-weight: 700; font-display: swap;
  src: url('../../fonts/GoogleSans-Bold.ttf') format('truetype');
}

:root {
  /* EDvanced design tokens — keep in sync with DESIGN.md */
  --primary:      #002347;
  --secondary:    #003366;
  --accent:       #0066cc;
  --accent-sky:   #38bdf8;
  --text:         #1a1a1a;
  --text-muted:   #555555;
  --background:   #f8f9fa;
  --surface:      #ffffff;
  --border:       #d9e2ec;
  --success:      #0f766e;
  --warning:      #b45309;
  --danger:       #be185d;
  --info:         #7c3aed;
  --rounded-sm:   6px;
  --rounded-md:   14px;
  --rounded-pill: 999px;
  --shadow-card:  0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);

  font-family: 'Google Sans Text', Inter, ui-sans-serif, system-ui, sans-serif;
  background: var(--background);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
}

button,
input,
textarea {
  font: inherit;
}

/* ── Focus ring ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── App shell ── */
.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px 40px;
}

/* ── Header ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.brand-block {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--rounded-md);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--accent);
}

.brand-logo span {
  width: 20px;
  height: 20px;
  border: 2.5px solid #fff;
  border-radius: 50%;
  position: relative;
}

.brand-logo span::before,
.brand-logo span::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.5px;
  border-radius: 999px;
  background: #fff;
  transform-origin: 50% 0;
}

.brand-logo span::before {
  height: 7px;
  transform: translate(-50%, 0) rotate(0deg);
}

.brand-logo span::after {
  height: 5px;
  transform: translate(-50%, 0) rotate(120deg);
}

.brand-block h1 {
  margin: 0;
  font-family: 'Google Sans', Inter, sans-serif;
  color: var(--primary);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1;
}

.brand-block p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.2;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.header-pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--rounded-pill);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: border-color 140ms ease;
}

.header-pill.is-active {
  background: var(--secondary);
  color: #ffffff;
  border-color: var(--secondary);
}

/* ── Intro band (page header) ── */
.intro-band {
  display: grid;
  gap: 8px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0;
  color: var(--text-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 500;
}

.intro-band h2 {
  margin: 0;
  font-family: 'Google Sans', Inter, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--primary);
}

.hero-text {
  margin: 0;
  color: var(--text-muted);
  max-width: 640px;
  font-size: 0.9375rem;
  line-height: 1.65;
}

/* ── Grid layout ── */
.grid-panel {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rounded-md);
  padding: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card h2 {
  margin: 0;
  font-family: 'Google Sans', Inter, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
}

/* ── Toolbar ── */
.toolbar {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr auto;
  align-items: end;
}

/* ── Form fields ── */
.field-label {
  display: grid;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-muted);
}

.field-label input,
input[type='number'],
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--rounded-sm);
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 140ms ease;
}

.field-label input:focus-visible,
input[type='number']:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

/* ── Timer display ── */
.timer-card {
  display: grid;
  gap: 8px;
  text-align: center;
  padding: 16px 0;
}

.timer-display {
  font-family: 'Google Sans', Inter, sans-serif;
  font-size: clamp(4rem, 10vw, 8rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--primary);
  line-height: 1;
  transition: color 300ms ease;
}

.status-text {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.phase-display {
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
}

.phase-prompt {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.55;
  max-width: 440px;
  margin: 0 auto;
}

/* ── Button rows ── */
.button-row,
.actions-row,
.custom-time-row {
  display: grid;
  gap: 10px;
}

.presets-row,
.actions-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.adjust-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.custom-time-row {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}

/* ── Buttons — base (secondary) ── */
button {
  padding: 11px 18px;
  border: 1px solid var(--border);
  border-radius: var(--rounded-pill);
  background: var(--surface);
  color: var(--primary);
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button:disabled:hover {
  border-color: var(--border);
  color: var(--primary);
  background: var(--surface);
}

/* ── Primary buttons ── */
#startButton,
#startWorkflowButton,
#savePresetButton {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 700;
}

#startButton:hover:not(:disabled),
#startWorkflowButton:hover:not(:disabled),
#savePresetButton:hover:not(:disabled) {
  background: #0052a3;
  border-color: #0052a3;
  color: #ffffff;
}

/* ── Danger secondary (Reset) ── */
#resetButton {
  color: var(--danger);
  border-color: var(--danger);
}

#resetButton:hover:not(:disabled) {
  background: var(--danger);
  color: #ffffff;
}

/* ── Minimum heights for action controls ── */
#fullscreenButton,
#savePresetButton,
#preset5, #preset10, #preset15,
#decButton, #incButton,
#setButton,
#startWorkflowButton {
  min-height: 48px;
}

/* ── Full-width sidebar primary actions ── */
#startWorkflowButton,
#savePresetButton {
  width: 100%;
}

/* ── Workflow time grid ── */
.workflow-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ── History and preset lists ── */
.history-list,
.preset-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.history-list li {
  padding: 10px 14px;
  border-radius: var(--rounded-sm);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.4;
}

.preset-list button {
  text-align: left;
  border-radius: var(--rounded-sm);
  padding: 10px 14px;
  background: var(--background);
  font-size: 0.875rem;
  min-height: unset;
}

.note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.55;
}

/* ── Footer ── */
.app-footer {
  margin-top: 32px;
  padding: 18px 8px 8px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.7;
  text-align: center;
}

.app-footer-title {
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
}

.app-footer-version {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 700;
  border-radius: var(--rounded-sm);
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.app-contact {
  max-width: 520px;
  margin: 12px auto;
}

.app-contact-title {
  color: var(--text);
  font-weight: 500;
}

.app-contact a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.app-contact a:hover {
  text-decoration: underline;
}

/* ── Timer end pulse ── */
@keyframes timer-end-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.timer-display.is-ended {
  animation: timer-end-pulse 0.5s ease-in-out 4;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .grid-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .header-pill {
    min-height: 32px;
    padding: 0 12px;
    font-size: 0.75rem;
  }

  .toolbar,
  .custom-time-row {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 16px;
  }

  .actions-row,
  .workflow-grid {
    grid-template-columns: 1fr;
  }
}
