/* Display fonts that were previously imported are not used in the UI.
   Keep the app clean and readable with Inter. */

:root {
  --text: #f6f7fb;
  --muted: #c9d2e3;
  --surface: rgba(13, 17, 23, 0.88);
  --surface-2: rgba(255,255,255,0.10);
  --border: rgba(255,255,255,0.14);
  --border-strong: rgba(255,255,255,0.22);
  --accent: #6ee7f0;
  --accent-2: #3b82f6;
  --btn-bg: rgba(17, 24, 39, 0.6);
  --btn-border: rgba(255,255,255,0.15);
  --timer-safe: #22c55e;
  --timer-warn: #f59e0b;
  --timer-alert: #ef4444;
  --ui-font: 'Nunito', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  /* Soft pill colors for primary buttons */
  --pill-bg: rgba(255,255,255,0.92);
  --pill-bg-2: rgba(255,255,255,0.86);
  --pill-border: rgba(255,255,255,0.78);
  --pill-hover: rgba(255,255,255,0.98);
}

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#background-video {
    position: fixed;
    right: 0;
    bottom: 0;
    min-width: 100%;
    min-height: 100%;
    z-index: -1;
    object-fit: cover;
}

header {
    text-align: center;
    margin-top: 20px;
}

.logo {
    font-family:'Fredoka One', cursive;
    font-size: 3rem;
    color: #ffffff;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
    letter-spacing: 8px;
}

.logo span {
    display: block;
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: #90e0ef;
    margin-top: 5px;
    letter-spacing: 4px;
}

.class {
    display: block;
}

.base-timer {
    position: relative;
    height: 300px;
    width: 300px;
    margin: 12px 0;
}

.base-timer__circle {
    fill: none;
    stroke: none;
}

.base-timer__path-elapsed {
    stroke-width: 7px;
    stroke: rgba(255,255,255,0.28);
}

.base-timer__label {
    position: absolute;
    width: 300px;
    height: 300px;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.base-timer__path-remaining {
    stroke-width: 7px;
    stroke-linecap: round;
    transform: rotate(90deg);
    transform-origin: center;
    transition: 1s linear all;
    stroke: currentColor;
}

.spotify-fab { position: fixed; left: 4vw; bottom: 6vh; z-index: 16; width: 300px; padding: 8px; border-radius: 18px; background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.18); backdrop-filter: blur(8px); box-shadow: 0 12px 30px rgba(0,0,0,.28); transform: translateX(0); transition: transform .25s ease; overflow: visible; }
.spotify-fab.collapsed { transform: translateX(calc(-100% + 44px)); }
.spotify_playlist { width: 100%; margin: 0; }
.spotify_playlist iframe { width: 100%; height: 160px; display: block; border-radius: 12px; }
#apple-embed { background: rgba(0,0,0,0.2); }
.spotify-toggle { position: absolute; right: -12px; top: 50%; transform: translateY(-50%); width: 28px; height: 56px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.22); background: rgba(255,255,255,0.18); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(8px); box-shadow: 0 8px 18px rgba(0,0,0,.25); }
.spotify-toggle:hover { background: rgba(255,255,255,0.24); }
#spotify-toggle-icon { font-size: .95rem; }

/* Provider switch shown above the widget */
.provider-switch { position: absolute; top: -38px; left: 12px; display: inline-flex; gap: 6px; background: transparent; border: none; padding: 0; border-radius: 999px; z-index: 2; }
.provider-btn { cursor: pointer; font-family: var(--ui-font); font-weight: 700; font-size: .86rem; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.65); background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.95); transition: background-color .15s ease, border-color .15s ease, box-shadow .2s ease; backdrop-filter: blur(6px); box-shadow: 0 6px 16px rgba(0,0,0,.10); }
.provider-btn:hover { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.75); }
.provider-btn.outline { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.95); border-color: rgba(255,255,255,0.55); }
.provider-btn.active { background: rgba(255,255,255,0.96); color: #0e1726; border-color: rgba(255,255,255,0.95); box-shadow: 0 8px 22px rgba(0,0,0,.18); }

/* Fullscreen floating button */
.fullscreen-btn {
  position: fixed;
  right: 4vw;
  bottom: 6vh;
  z-index: 20;
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 999px;
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.24);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform .1s ease, background .2s ease, border-color .2s ease;
}
.fullscreen-btn:hover { background: rgba(255,255,255,0.22); transform: translateY(-1px); }
.fullscreen-btn:focus-visible { outline: 2px solid rgba(255,255,255,0.9); outline-offset: 2px; }
#fullscreen-icon { font-size: 1.25rem; }

/* Onboarding chooser removed */

.button_timer {
    cursor: pointer;
    color: var(--text);
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    padding: 10px 14px;
    border-radius: 10px;
    backdrop-filter: blur(4px);
    transition: transform .08s ease, background .2s ease, border-color .2s ease;
    font-family: var(--ui-font);
}
.button_timer:hover { 
    transform: translateY(-1px);
    border-color: rgba(255,255,255,0.3);
}

#button-timer-restart {
    background: transparent;
    border: none;
}
#button-timer-settings {
    background: transparent;
    border: none;
}
/* Mode buttons: outlined pills like the reference */
.pomodoro_buttons {
  cursor: pointer;
  color: #ffffff;
  background-color: transparent;
  border: 1px solid rgba(255,255,255,0.75);
  padding: 10px 18px;
  border-radius: 999px;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .2s ease;
  margin: 4px 2px;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: .05px;
  font-family: var(--ui-font);
  min-height: 44px;
  will-change: background-color, box-shadow, border-color;
}
.pomodoro_buttons:hover {
  background-color: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.9);
}
.pomodoro_buttons:active { transform: none; }
.pomodoro_buttons:focus-visible {
  outline: 2px solid rgba(255,255,255,0.9);
  outline-offset: 2px;
}
.pomodoro_buttons.active {
  color: #0e1726;
  background-color: rgba(255,255,255,0.96);
  border-color: rgba(255,255,255,0.95);
  box-shadow: 0 8px 22px rgba(0,0,0,.22), 0 0 0 2px rgba(59,130,246,.36);
  font-weight: 700;
}

/* Start button keeps filled style for primary action */
#button-timer-start-stop {
  cursor: pointer;
  color: #0e1726;
  background-color: rgba(255,255,255,0.92);
  border: 1px solid var(--pill-border);
  padding: 10px 18px;
  border-radius: 999px;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .2s ease;
  margin: 4px 2px;
  box-shadow: 0 6px 18px rgba(0,0,0,.16);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: .05px;
  font-family: var(--ui-font);
  min-height: 44px;
  will-change: background-color, box-shadow, border-color;
}
#button-timer-start-stop:hover {
  background-color: rgba(255,255,255,0.98);
  border-color: rgba(255,255,255,0.92);
  box-shadow: 0 8px 22px rgba(0,0,0,.20);
}
#button-timer-start-stop:active { transform: none; }
#button-timer-start-stop:focus-visible {
  outline: 2px solid rgba(59,130,246,0.6);
  outline-offset: 2px;
}

/* Primary Start/Stop button now matches mode buttons via combined selector above */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.45);
}

.modal-content {
  position: relative; 
  width: min(780px, 94vw);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  padding: 22px 22px 16px;
  max-height: 92vh;
  overflow: auto;
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}

/* Mobile-friendly modal: turn into a neat bottom sheet */
@media (max-width: 640px) {
  /* Smaller, centered dialog on phones */
  .modal { align-items: center; }
  .modal-content {
    width: min(520px, 92vw);
    max-width: 92vw;
    border-radius: 16px;
    padding: 12px 14px 10px;
    max-height: 70vh;
    -webkit-overflow-scrolling: touch;
  }
  #close-button {
    position: absolute;
    top: 8px;
    right: 8px;
    border-radius: 12px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.14);
    z-index: 3;
  }
  .modal-grid { gap: 12px; }
  .modal-grid .tab-menu {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 6px;
    margin: 0;
  }
  .modal-grid .tab-link {
    text-align: center;
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.10);
    border-color: var(--border);
    flex: 0 0 auto;
  }
  .tab-content h2 { font-size: 1.12rem; margin-top: 2px; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .modal-footer {
    position: static;
    padding: 10px 0 0;
    background: transparent;
    border-top: 1px solid var(--border);
    grid-template-columns: 1fr auto auto;
    gap: 8px;
  }
}

/* Modal grid: sidebar + content */
.modal-grid { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
@media (max-width: 640px) { .modal-grid { grid-template-columns: 1fr; } }
.modal-grid .tab-menu { display: flex; flex-direction: column; gap: 8px; border: none; margin: 4px 0 0; }
.modal-grid .tab-link { padding: 12px 12px; background: transparent; border: 1px solid transparent; color: rgba(255,255,255,0.88); text-align: left; border-radius: 12px; font-weight: 500; letter-spacing: .2px; }
.modal-grid .tab-link, .form-grid label, .form-grid input, .form-grid select, .switch-text .switch-title, .switch-text .switch-desc, .modal-footer button, .disclaimer, .tab-content h2 { font-family: var(--ui-font); }
.modal-grid .tab-link:hover { background: var(--surface-2); border-color: var(--border); }
.modal-grid .tab-link.active { background: rgba(255,255,255,0.14); border-color: var(--border-strong); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); }

.tab-content h2 { margin-top: 4px; margin-bottom: 12px; font-size: 1.35rem; font-weight: 650; letter-spacing: .2px; }
.form-grid .hint { font-size: .75rem; color: var(--muted); margin-top: 4px; }

/* Switch row */
.switch-row { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; margin-top: 10px; }
.switch { position: relative; width: 48px; height: 26px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: rgba(255,255,255,0.22); border: 1px solid rgba(255,255,255,0.28); transition: .2s; border-radius: 999px; }
.slider:before { content: ""; position: absolute; height: 18px; width: 18px; left: 4px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.switch input:checked + .slider { background: rgba(255,255,255,0.95); }
.switch input:checked + .slider:before { transform: translateX(22px); }
.switch-text .switch-title { font-weight: 600; }
.switch-text .switch-desc { font-size: .85rem; color: var(--muted); }

/* Modal footer buttons */
.modal-footer { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--border); }
.modal-footer .reset, .modal-footer .close, .modal-footer .save { font-size: 1rem; font-weight: 600; padding: 10px 18px; min-height: 40px; line-height: 1; letter-spacing: .05px; }
.modal-footer .reset { justify-self: start; background: transparent; color: #ff6b6b; border: 1px solid rgba(255,107,107,0.7); border-radius: 999px; padding: 10px 16px; cursor: pointer; }
.modal-footer .reset:hover { background: rgba(255,107,107,0.08); transform: translateY(-1px); }
.modal-footer .close { background: rgba(255,255,255,0.26); color: #0e1726; border: none; border-radius: 999px; padding: 10px 16px; cursor: pointer; }
.modal-footer .close:hover { background: rgba(255,255,255,0.34); transform: translateY(-1px); }
.modal-footer .save { background: rgba(255,255,255,0.96); color: #0e1726; border: none; border-radius: 999px; padding: 10px 16px; cursor: pointer; box-shadow: 0 8px 28px rgba(0,0,0,.22); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.modal-footer .save:hover { background: #fff; transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0,0,0,.26); }
.modal-footer .save:focus-visible { outline: 3px solid rgba(255,255,255,0.95); outline-offset: 2px; }
.hidden {
    display: none;
}

.tab-menu { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; border: none; }
.tab-link { padding: 10px 16px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14); color: #fff; border-radius: 999px; cursor: pointer; text-align: center; min-width: 120px; }
.tab-link:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.22); }
.tab-link.active { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.28); font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.24); }
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}
/* Remove older duplicate footer block (consolidated above) */

.settings-modal {
  position: relative; 
  background: #111;
  border-radius: 10px;
  padding: 20px;
  width: 500px;
  margin: 0 auto;
}

#close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  padding: 6px 8px;
}
#close-button i { font-size: 1.2rem; color: #fff; }
#close-button:hover { background: rgba(255,255,255,0.14); }

@media (max-width: 640px) {
  #close-button { 
    position: sticky; 
    align-self: flex-end; 
    top: 0; 
    right: 0; 
    border-radius: 12px; 
    padding: 8px 10px; 
  }
}

/* Reload icon animation */
@keyframes spinOnce {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
#button-timer-restart-icon.spin {
  display: inline-block;
  animation: spinOnce 0.7s ease-in-out;
}

/* ===== Aesthetic Enhancements ===== */
/* Themes */
body.theme-rain { --accent: #6ee7f0; --accent-2: #3b82f6; }
body.theme-forest { --accent: #86efac; --accent-2: #22c55e; }
body.theme-sunset { --accent: #fda4af; --accent-2: #fb7185; }

/* Background image + overlay */
#bg-image { position: fixed; inset: 0; background-size: cover; background-position: center; z-index: -2; display: block; }
.bg-overlay { position: fixed; inset: 0; z-index: -1; background: radial-gradient(1200px 700px at 50% 10%, rgba(0,0,0,.06), rgba(0,0,0,.18)), linear-gradient(to bottom, rgba(0,0,0,.06), rgba(0,0,0,.2)); }

/* Topbar + Layout */
.topbar { text-align: center; width: min(1100px, 92vw); margin: 20px auto 8px; display: flex; align-items: center; justify-content: space-between; }
.layout { width: 100vw; max-width: 100%; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 100vh; justify-content: center; padding: 4vh 0; }
.card { background: transparent; border: none; border-radius: 18px; padding: 6px 10px 10px; backdrop-filter: none; box-shadow: none; }
.card-title { font-weight: 600; margin-bottom: 10px; }
.focus-card { text-align: center; transform: translateY(-3vh); }
@media (max-width: 640px) { .focus-card { transform: none; } }
.content-grid { width: min(1100px, 94vw); display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
@media (max-width: 980px) { .content-grid { grid-template-columns: 1fr; } }
.left-rail { display: flex; flex-direction: column; gap: 12px; }
.mode-buttons { display: flex; gap: 12px; justify-content: center; margin: 8px 0 12px; flex-wrap: wrap; }
.mode-buttons { position: relative; z-index: 1; }

/* Center title above controls */
/* Title base */
.app-title {
  margin: 8px 0 14px;
  font-weight: 800;
  font-size: clamp(1.35rem, 1.2rem + 0.8vw, 1.9rem);
  line-height: 1.12;
  letter-spacing: .2px;
  color: rgba(255,255,255,0.98);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
.app-title { pointer-events: none; }

/* Variant: Glass pill */
.app-title.title--glass {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.10), rgba(255,255,255,0.06));
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 10px 28px rgba(0,0,0,0.28);
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}

/* Variant: Clean */
.app-title.title--clean {
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}

/* Variant: Soft gradient (text only) */
.app-title.title--gradient {
  background: linear-gradient(180deg, #ffffff 0%, rgba(255,255,255,.82) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}

/* Variant: Subtle glow */
.app-title.title--glow {
  text-shadow: 0 0 12px rgba(255,255,255,0.35), 0 2px 8px rgba(0,0,0,0.35);
}

/* Variant: Serif accent */
.app-title.title--serif {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  letter-spacing: .3px;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}

/* Timer placement & label */
.base-timer { margin: 6px auto 12px; height: 420px; width: 420px; }
.base-timer__label { width: 420px; height: 420px; font-size: 112px; font-weight: 800; color: #fff; text-shadow: 0 8px 40px rgba(0,0,0,.55), 0 2px 12px rgba(0,0,0,.35); letter-spacing: -1px; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "lnum" 1; }
/* Keep timer digits in Inter for crisp numerals */
.base-timer__label { font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; }

/* Buttons */
.button_timer.primary { font-size: 1.05rem; padding: 14px 26px; border-radius: 999px; background: rgba(255,255,255,0.92); color: #0e1726; border-color: rgba(255,255,255,0.0); box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.button_timer.primary:hover { background: rgba(255,255,255,1); transform: translateY(-1px); }
.button_timer.ghost { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.24); border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; padding: 12px 14px; min-width: 48px; min-height: 48px; }
.button_timer.ghost:hover { transform: translateY(-2px); background: rgba(255,255,255,0.22); }
.button_timer.ghost:focus-visible { outline: 2px solid rgba(255,255,255,0.9); outline-offset: 2px; }
.icon_button { cursor: pointer; color: var(--text); background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.22); border-radius: 999px; padding: 10px 12px; }
.icon_button:hover { border-color: rgba(255,255,255,0.35); }
.actions { display: flex; gap: 8px; justify-content: center; align-items: center; }
.actions { gap: 12px; }

/* Bigger restart and settings icons */
#button-timer-restart-icon, #button-timer-settings-icon { font-size: 1.5rem; color: #ffffff; text-shadow: 0 4px 18px rgba(0,0,0,.35); }

/* Settings form */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid label { display: grid; gap: 6px; font-size: .96rem; color: rgba(255,255,255,0.9); }
.form-grid input, .form-grid select { padding: 12px 12px; border-radius: 12px; border: 1px solid var(--border-strong); background: rgba(255,255,255,0.10); color: var(--text); box-shadow: inset 0 1px 1px rgba(0,0,0,.12); }
.form-grid input:focus, .form-grid select:focus { outline: 2px solid rgba(255,255,255,0.6); outline-offset: 1px; background: rgba(255,255,255,0.12); }
.checkbox { display: inline-flex; gap: 8px; align-items: center; margin-top: 6px; }

/* Modal visual tweaks */
.modal-content { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* Disclaimer styling */
.disclaimer { margin: 12px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.disclaimer strong { color: rgba(255,255,255,0.92); font-weight: 700; }

/* Session progress dots */
.session-progress { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.session-progress .dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.28); }
.session-progress .dot.active { background: var(--accent-2); box-shadow: 0 0 8px rgba(59,130,246,.6); }

/* ===== Responsive: mobile-first scaling ===== */
/* Use CSS variables to scale timer and label across viewports */
:root {
  --timer-size: clamp(240px, 70vw, 420px);
  --timer-font: clamp(54px, 20vw, 112px);
}

/* Override fixed sizes with responsive variables */
.base-timer { width: var(--timer-size); height: var(--timer-size); }
/* Keep digits inside the circle by tying font-size to timer size */
.base-timer__label { 
  width: var(--timer-size);
  height: var(--timer-size);
  font-size: clamp(40px, calc(var(--timer-size) * 0.26), 112px);
  line-height: 1;
}

/* Allow scrolling on small screens and tighten layout spacing */
/* Tablet and down: enable scroll, tighten spacing */
@media (max-width: 1024px) {
  /* Keep page fixed (no scrolling) on mobile/tablet */
  html, body { height: 100%; overflow: hidden; }
  .layout { min-height: 100vh; padding: 6vh 0 8vh; }
  .focus-card { transform: translateY(-8vh); }

  .app-title { padding: 6px 12px; font-size: clamp(1.05rem, 2.4vw, 1.35rem); }
  .mode-buttons { gap: 8px; }
  .pomodoro_buttons { padding: 10px 14px; font-size: .95rem; }
  #button-timer-start-stop { padding: 10px 16px; font-size: .98rem; }
  .button_timer.ghost { min-width: 40px; min-height: 40px; padding: 10px; }

  /* Reposition the music widget to bottom center and shrink */
  .spotify-fab { width: min(92vw, 360px); left: 50%; bottom: 16px; transform: translateX(-50%); }
  .spotify_playlist iframe { height: 120px; }
  .provider-switch { top: -34px; left: 10px; }

  .fullscreen-btn { right: 14px; bottom: 14px; }
  .actions { flex-wrap: wrap; }
}

/* Narrow phones: reduce max timer size and label */
@media (max-width: 480px) {
  :root { --timer-size: clamp(240px, 84vw, 380px); --timer-font: clamp(44px, 20vw, 84px); }
  .session-progress .dot { width: 8px; height: 8px; }
  .spotify_playlist iframe { height: 100px; }
  .spotify-toggle { right: -10px; height: 48px; }
  .pomodoro_buttons { padding: 8px 12px; font-size: .88rem; }
  .actions { gap: 8px; }
  /* Ensure content fits without scrolling */
  html, body { height: 100%; overflow: hidden; }
  .layout { min-height: 100vh; padding: 3vh 0 6vh; }
  .focus-card { transform: translateY(-11vh); }
}

/* Allow scrolling in mobile landscape so all controls are reachable */
@media (max-width: 1024px) and (orientation: landscape) {
  html, body { height: auto; overflow-x: hidden; overflow-y: auto; }
  .layout { min-height: unset; padding: 4vh 0 16vh; }
  .focus-card { transform: translateY(-3vh); }
}

/* Extra safety for tall/portrait phones: reduce font a bit more */
@media (max-width: 768px) and (orientation: portrait) {
  .base-timer__label { font-size: clamp(36px, calc(var(--timer-size) * 0.24), 96px); }
}

/* Compact laptops / large phones in landscape: start shrinking earlier */
/* Compact laptops and down: start shrinking earlier */
@media (max-width: 1200px) {
  /* keep desktop sizing; do not enlarge timer here */
  :root { --timer-size: clamp(240px, 70vw, 420px); --timer-font: clamp(54px, 20vw, 112px); }
  /* Hide space-heavy UI on iPad/tablet and smaller */
  .spotify-fab, .fullscreen-btn, .provider-switch { display: none !important; }
  .layout { padding-bottom: calc(6vh + env(safe-area-inset-bottom)); }
}

@media (max-width: 900px) {
  /* phones and small tablets: slightly larger circle but safe digits */
  :root { --timer-size: clamp(260px, 78vw, 440px); --timer-font: clamp(48px, 18vw, 100px); }
  .layout { padding: 4vh 0 7vh; }
  .focus-card { transform: translateY(-9vh); }
}

/* Force-hide heavy widgets on touch devices (phones/tablets) */
@media (hover: none), (pointer: coarse) {
  .spotify-fab, .provider-switch, .fullscreen-btn { display: none !important; }
}
