/* kronometrem.tr — shared styles */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

.layout-pending body {
  visibility: hidden;
}

@supports (overflow: clip) {
  html {
    overflow-x: clip;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  transition: background-color 0.15s ease, color 0.15s ease;
}

@supports (overflow: clip) {
  body {
    overflow-x: clip;
  }
}

/* Theme tokens */
.theme-dark {
  --bg: #07080d;
  --bg-elevated: #0f1118;
  --surface: #161b26;
  --surface-hover: #1e2535;
  --border: #2a3142;
  --text: #f4f6fb;
  --text-muted: #9aa3b8;
  --text-subtle: #6b7289;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --success: #34d399;
  --danger: #fb7185;
  --card-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  --focus-ring: rgba(129, 140, 248, 0.55);
}

.theme-light {
  --bg: #f6f7fb;
  --bg-elevated: #ffffff;
  --surface: #eef0f7;
  --surface-hover: #e4e7f2;
  --border: #d8dce8;
  --text: #111827;
  --text-muted: #4b5568;
  --text-subtle: #6b7280;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-glow: rgba(79, 70, 229, 0.2);
  --success: #059669;
  --danger: #e11d48;
  --card-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  --focus-ring: rgba(79, 70, 229, 0.45);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Global content width — header inner, main, footer inner */
.container,
.container--wide {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}

/* Header — outer bar full width; inner row uses same container as main/footer */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 100%;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  overflow-x: hidden;
  box-sizing: border-box;
}

@supports (overflow: clip) {
  .site-header {
    overflow-x: clip;
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
  padding: 0.5rem 0;
  box-sizing: border-box;
}

/* Header row: container alone controls width (avoids conflict with .header-inner) */
.site-header .container {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
  width: 100%;
  box-sizing: border-box;
}

.logo {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.logo:hover {
  text-decoration: none;
  color: var(--accent);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.nav-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.nav-wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
  justify-content: center;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  justify-content: center;
}

.nav a {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.nav a.is-active {
  color: var(--text);
  background: var(--surface);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.lang-switch,
.theme-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.lang-switch button,
.theme-toggle button {
  padding: 0.375rem 0.625rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.lang-switch button:hover,
.theme-toggle button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.lang-switch button.is-active,
.theme-toggle button.is-active {
  color: var(--text);
  background: var(--bg-elevated);
}

.lang-switch button + button,
.theme-toggle button + button {
  border-left: 1px solid var(--border);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.875rem;
  height: 2.875rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease, color 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.icon-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.icon-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Main */
main {
  padding: 2rem 0 3.5rem;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

@supports (overflow: clip) {
  main {
    overflow-x: clip;
  }
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: center;
  margin: 0 0 2rem;
  color: var(--text);
}

#stopwatch-app {
  min-width: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}

@supports (overflow: clip) {
  #stopwatch-app {
    overflow-x: clip;
  }
}

/* Fullscreen target wraps tabs + panels — clip overflow without horizontal scroll */
#fullscreen-target {
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

@supports (overflow: clip) {
  #fullscreen-target {
    overflow-x: clip;
  }
}

/* Tool shell (card + fullscreen region) */
.tool-shell {
  width: 100%;
  min-width: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem 1.25rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  box-sizing: border-box;
  overflow-x: hidden;
}

@supports (overflow: clip) {
  .tool-shell {
    overflow-x: clip;
  }
}

.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 2rem;
  padding: 0.35rem;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.mode-tab {
  flex: 1;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.mode-tab:hover:not(.is-active) {
  color: var(--text);
  background: var(--surface-hover);
}

.mode-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.theme-light .mode-tab.is-active {
  color: #fff;
}

.tool-panel {
  display: none;
}

.tool-panel.is-visible {
  display: block;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

@supports (overflow: clip) {
  .tool-panel.is-visible {
    overflow-x: clip;
  }
}

body.is-tool-fullscreen {
  overflow: hidden;
}

body.is-tool-fullscreen .site-header,
body.is-tool-fullscreen .site-footer,
body.is-tool-fullscreen .related-tools,
body.is-tool-fullscreen .lap-section,
body.is-tool-fullscreen .alarm-dual-layout,
body.is-tool-fullscreen .page-title {
  display: none !important;
}

body.is-tool-fullscreen main {
  padding: 0;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

body.is-tool-fullscreen #stopwatch-app,
body.is-tool-fullscreen #alarm-app,
body.is-tool-fullscreen #timer-app,
body.is-tool-fullscreen #world-clock-app {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}

body.is-tool-fullscreen .tool-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  border-radius: 0;
  border: none;
  min-height: 100vh;
  padding: 2rem 1.5rem 3rem;
}

body.is-tool-fullscreen.fs-hide-secondary .controls-secondary {
  display: none;
}

body.is-tool-fullscreen .shortcut-hint {
  display: none !important;
}

.placeholder-page .page-title {
  margin-bottom: 2rem;
}

.placeholder-main {
  min-height: 40vh;
}

.world-clock-hero {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.world-clock-main-time {
  margin-bottom: 0.65rem;
}

.world-clock-search-section {
  margin-top: 0;
}

.world-clock-search-input {
  width: 100%;
  min-height: 3rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
}

.world-clock-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.world-clock-city-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.world-clock-city-card {
  cursor: default;
}

.world-clock-city-name {
  font-size: 1.1rem;
  color: var(--text);
}

.world-clock-country {
  margin-top: 0.35rem;
  margin-bottom: 0.75rem;
}

.world-clock-city-time {
  margin: 0;
  font-family: "Chakra Petch", ui-monospace, monospace;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
}

.world-clock-city-diff {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.world-clock-card-dim {
  opacity: 0.45;
}

.world-clock-card-match {
  border-color: var(--accent);
}

.world-clock-seo .tool-card {
  display: flex;
  align-items: center;
}

.highlight-card {
  border-color: var(--accent) !important;
  box-shadow: 0 12px 28px var(--accent-glow);
}

/* Stopwatch / countdown hero */
.stopwatch-hero,
.countdown-hero {
  text-align: center;
  margin-bottom: 0;
  min-width: 0;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.timer-display,
.countdown-display {
  font-family: "Chakra Petch", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: var(--timer-font-size, clamp(3.25rem, 14vw, 6.25rem));
  letter-spacing: 0.06em;
  line-height: 1.05;
  color: var(--text);
  margin: 0 auto 1.25rem;
  user-select: none;
  text-shadow: 0 2px 24px var(--accent-glow);
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

@supports (overflow: clip) {
  .timer-display,
  .countdown-display {
    overflow-x: clip;
  }
}

.countdown-display.is-warning {
  color: var(--danger);
  text-shadow: 0 0 24px rgba(251, 113, 133, 0.35);
}

.timer-display.no-ms .ms-part {
  display: none;
}

.sub-display {
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--text-muted);
  min-height: 1.6em;
  font-variant-numeric: tabular-nums;
  margin: 0 auto 0.5rem;
  padding: 0 0.25rem;
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: hidden;
  text-align: center;
}

@supports (overflow: clip) {
  .sub-display {
    overflow-x: clip;
  }
}

.countdown-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: center;
  align-items: flex-end;
  margin: 1.75rem 0 1.5rem;
}

.countdown-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-width: 5.5rem;
}

.countdown-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
}

.countdown-input {
  width: 5.5rem;
  padding: 0.65rem 0.75rem;
  text-align: center;
  font-family: "Chakra Petch", ui-monospace, monospace;
  font-size: 1.25rem;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.countdown-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.countdown-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sub-display .label {
  color: var(--text-subtle);
  margin-right: 0.35rem;
}

/* Controls */
.controls-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
  align-items: center;
  margin: 2rem auto 1.25rem;
  width: 100%;
  box-sizing: border-box;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.125rem;
  padding: 0 1.65rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.15s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  min-width: 8.5rem;
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 8px 28px var(--accent-glow);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--text-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface);
  border-color: var(--text-subtle);
}

.controls-secondary {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  margin: 0 auto 2rem;
  width: 100%;
  box-sizing: border-box;
}

.shortcut-hint {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: -1.25rem auto 1.25rem;
  text-align: center;
  white-space: nowrap;
  max-width: 100%;
  overflow-x: auto;
  padding: 0 0.25rem;
  pointer-events: none;
}

/* Lap section */
.lap-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--card-shadow);
}

.lap-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.lap-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.lap-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin: 0;
}

.lap-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
}

.lap-row {
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.lap-row:last-child {
  border-bottom: none;
}

.lap-num {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.lap-time {
  font-weight: 600;
  color: var(--text);
}

.lap-copy {
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}

.lap-copy:hover {
  background: var(--surface-hover);
}

.lap-empty {
  list-style: none;
  text-align: center;
  color: var(--text-subtle);
  font-size: 0.9375rem;
  padding: 1.5rem 1rem;
  margin: 0;
}

.btn--compact {
  min-height: 2.25rem !important;
  padding: 0 0.75rem !important;
  font-size: 0.875rem !important;
}

/* Related tools */
.related-tools {
  margin-bottom: 3rem;
}

.related-tools h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.tool-card {
  display: block;
  padding: 1.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.theme-dark .tool-card {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.tool-card:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px var(--accent-glow);
}

.tool-card span {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.setting-range-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 2.5rem 0 0;
  margin-top: auto;
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

@supports (overflow: clip) {
  .site-footer {
    overflow-x: clip;
  }
}

.footer-wrap {
  padding-bottom: 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem 2.5rem;
  align-items: start;
}

.footer-grid > .footer-col {
  min-width: 0;
}

.footer-col--brand {
  min-width: 0;
}

.footer-brand {
  display: inline-block;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 0.75rem;
}

.footer-brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.footer-desc {
  margin: 0 0 1.125rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.footer-social-link {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.footer-social-link:hover {
  color: var(--accent-hover);
  background: var(--surface-hover);
  border-color: var(--accent);
  text-decoration: none;
}

.footer-col-title {
  margin: 0 0 0.875rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
}

.footer-col-title--follow {
  margin-top: 1.25rem;
}

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

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links li:last-child {
  margin-bottom: 0;
}

.footer-links a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-copy {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-subtle);
  text-align: center;
}

/* Modal / settings */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(100%, 400px);
  height: 100%;
  max-height: 100vh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-panel.is-open {
  transform: translateX(0);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.settings-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
}

.settings-close {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.settings-body {
  padding: 1rem 1.25rem 2rem;
  overflow-y: auto;
  flex: 1;
}

.settings-group {
  margin-bottom: 1.75rem;
}

.settings-group h3 {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-row--multiline {
  align-items: flex-start;
}

.setting-label-col {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.setting-hint {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-subtle);
  line-height: 1.35;
}

.setting-row label {
  color: var(--text-muted);
}

.setting-row input[type="range"] {
  width: 120px;
}

.settings-body select {
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.15s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--text);
  color: var(--bg);
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 300;
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  pointer-events: none;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Mobile header + layout */
@media (max-width: 768px) {
  .header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    align-items: center;
    column-gap: 0.5rem;
    row-gap: 0.65rem;
  }

  .logo {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    align-self: center;
    min-width: 0;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    margin-right: 0.125rem;
  }

  .header-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    width: 100%;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding: 0 0.25rem;
    box-sizing: border-box;
  }

  .nav-wrap {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.2s ease;
    padding: 0;
    gap: 0.75rem;
  }

  .nav-wrap.is-open {
    max-height: 320px;
    opacity: 1;
    padding: 0.75rem 0 0;
  }

  .nav {
    flex-direction: column;
    align-items: stretch;
  }

  .nav a {
    text-align: center;
  }

  .controls-primary {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
  }

  .controls-secondary {
    justify-content: center;
  }

  .btn-primary {
    width: 100%;
  }

  .stopwatch-hero,
  .countdown-hero {
    width: 100%;
    max-width: 100%;
  }

  #timer-display,
  #countdown-display,
  #alarm-live-clock,
  #timer-main-display {
    display: flex;
    justify-content: center;
    align-items: center;
    letter-spacing: 0.028em;
    text-align: center;
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 8px;
    padding-right: 8px;
    box-sizing: border-box;
    overflow: visible;
    white-space: nowrap;
    font-size: calc(var(--timer-scale, 1) * 18vw);
  }

  /* Stopwatch mobile default scale: 100% only */
  #stopwatch-app #timer-display {
    font-size: calc(1 * 18vw);
  }

  .mode-tabs {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-desc {
    max-width: none;
  }
}

@media (min-width: 769px) {
  .page-title {
    font-size: 1.75rem;
  }

  #stopwatch-app .stopwatch-bottom-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: stretch;
  }

  #stopwatch-app .stopwatch-bottom-layout > .lap-section,
  #stopwatch-app .stopwatch-bottom-layout > .related-tools {
    margin-bottom: 0;
  }

  .footer-social {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.3125rem;
    overflow-x: hidden;
  }

  @supports (overflow: clip) {
    .footer-social {
      overflow-x: clip;
    }
  }
}

/* —— Alarm page (alarm.html) —— */
.alarm-meta-line {
  margin: 0 auto 0.35rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
}

.alarm-meta-line--weekday {
  margin-bottom: 0.5rem;
  font-size: 1.0625rem;
  color: var(--text);
}

.alarm-dual-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  margin-bottom: 2.5rem;
  box-sizing: border-box;
  min-width: 0;
}

.alarm-dual-layout > .lap-section {
  margin-bottom: 0;
  min-width: 0;
}

@media (min-width: 769px) {
  .alarm-dual-layout {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
  }

  .alarm-dual-layout > .lap-section {
    height: 100%;
  }
}

.alarm-quick-section .lap-section-title {
  margin-bottom: 0.85rem;
}

.alarm-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.25rem, 1fr));
  gap: 0.5rem;
}

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

.alarm-quick-btn {
  min-height: 2.5rem !important;
  padding: 0 0.5rem !important;
  font-variant-numeric: tabular-nums;
}

.alarm-last-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
}

#timer-last-list {
  height: 420px;
  max-height: 420px;
  overflow-y: auto;
}

.alarm-last-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.625rem 0.5rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.alarm-last-row:last-child {
  border-bottom: none;
}

.alarm-last-text {
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.alarm-last-section--manage .alarm-last-row {
  cursor: default;
}

.alarm-active-list {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.alarm-active-card {
  text-align: left;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.alarm-active-card--disabled {
  opacity: 0.55;
}

.alarm-active-card--ringing {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.alarm-active-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.alarm-active-title {
  font-weight: 700;
  color: var(--text);
}

.alarm-active-time {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.alarm-active-countdown {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.alarm-active-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.alarm-dlg-backdrop {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.alarm-dlg-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.alarm-dlg {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  z-index: 221;
  width: min(100% - 2rem, 420px);
  max-height: min(90vh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
}

.alarm-dlg.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.alarm-dlg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.alarm-dlg-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
}

.alarm-dlg-title--center {
  text-align: center;
  width: 100%;
}

.alarm-dlg-x {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.alarm-dlg-body {
  padding: 1rem 1.25rem 1.25rem;
  overflow-y: auto;
}

.alarm-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.alarm-form-row label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}

.alarm-form-select,
.alarm-form-input {
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
}

.alarm-form-select--grow {
  flex: 1;
  min-width: 0;
}

.alarm-form-row--sound .alarm-sound-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.alarm-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
  cursor: pointer;
}

.alarm-dlg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

.alarm-dlg--test {
  z-index: 222;
  width: min(100% - 2rem, 320px);
  padding: 1.5rem 1.25rem;
}

.alarm-dlg-test-inner {
  text-align: center;
}

.alarm-test-icon {
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.alarm-test-icon svg {
  display: block;
  margin: 0 auto;
}

.alarm-test-time {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: "Chakra Petch", ui-monospace, monospace;
  color: var(--text);
}

.alarm-test-ok {
  width: 100%;
}
