:root {
  /* Colors */
  --color-primary: #0078d7;
  --color-primary-dark: #4fc3f7;
  --bg-light: #f4f4f4;
  --bg-dark: #181c1f;
  --panel-light: #fff;
  --panel-dark: #23272b;
  --text-light: #222;
  --text-dark: #e0e0e0;
  --border-light: #bbb;
  --border-dark: #444;
  --shadow-light: rgba(0,0,0,0.08);
  --shadow-dark: rgba(0,0,0,0.25);
  --timer-success: #00e676;
  --timer-warning: #ffeb3b;
  --timer-danger: #ff1744;
  --timer-gradient-start: #00e676;
  --timer-gradient-mid: #ffeb3b;
  --timer-gradient-end: #ff1744;
  
  /* Animations */
  --anim-duration: 0.3s;
  --anim-timing: cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Sizes */
  --timer-size-desktop: 200px;
  --timer-size-mobile: 160px;
  --spacing-base: 1rem;
  --border-radius: 1em;
}

/* Reset and base styles */
body {
  background: var(--bg-light);
  color: var(--text-light);
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  transition: background var(--anim-duration), color var(--anim-duration);
}

/* Timer panel styles */
#timerPanel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-base);
  background: var(--panel-light);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 16px var(--shadow-light);
  padding: calc(var(--spacing-base) * 2);
  max-width: 420px;
  width: 90%;
  margin: calc(var(--spacing-base) * 2) auto;
  animation: panelAppear var(--anim-duration) var(--anim-timing);
}

/* Timer visual styles */
#timerVisual {
  position: relative;
  width: var(--timer-size-desktop);
  height: var(--timer-size-desktop);
  margin-bottom: var(--spacing-base);
  transition: transform var(--anim-duration) var(--anim-timing);
}

#timerVisual.running {
  transform: scale(1.02);
}

#timerVisual.paused {
  transform: scale(0.98);
  opacity: 0.8;
}

/* Enhanced timer animations */
#timerVisual.animation-pulse {
  animation: timerPulseScale 1.5s ease-in-out infinite;
}

#timerVisual.animation-pulse .timer-bg {
  animation: timerPulseOpacity 1.5s ease-in-out infinite;
}

#timerVisual.animation-glow svg {
  filter: drop-shadow(0 0 15px var(--timer-gradient-mid));
  animation: timerGlow 2s ease-in-out infinite;
}

@keyframes timerPulseScale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes timerPulseOpacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

@keyframes timerGlow {
  0%, 100% { filter: drop-shadow(0 0 8px var(--timer-gradient-mid)); }
  50% { filter: drop-shadow(0 0 25px var(--timer-gradient-mid)); }
}

/* Dynamic gradient for timer */
#timerProgress {
  transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

/* Timer completion animation */
#timerVisual.timer-complete {
  animation: timerComplete 0.6s ease-out;
}

@keyframes timerComplete {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}


/* Form styles */
#timerForm {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5em;
  background: rgba(0,0,0,0.03);
  border-radius: calc(var(--border-radius) / 2);
  padding: calc(var(--spacing-base) * 0.7);
  margin: calc(var(--spacing-base) * 0.5) 0;
  transition: background var(--anim-duration);
}

#timerVisualText {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2em;
  font-weight: 500;
}

/* Button animations */
button {
  transition: all var(--anim-duration) var(--anim-timing);
}

button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--shadow-light);
}

button:not(:disabled):active {
  transform: translateY(1px);
}

/* Animations */
@keyframes panelAppear {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseStart {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Enhanced responsive design */
@media (max-width: 480px) {
  :root {
    --spacing-base: 0.8rem;
  }

  #timerPanel {
    padding: calc(var(--spacing-base) * 1.5);
    margin: var(--spacing-base);
    width: auto;
  }
  
  #timerVisual {
    width: var(--timer-size-mobile);
    height: var(--timer-size-mobile);
  }
  
  #timerVisual svg {
    width: var(--timer-size-mobile);
    height: var(--timer-size-mobile);
  }
  
  #timerVisualText {
    font-size: 1.6em;
  }
  
  #timerForm {
    padding: calc(var(--spacing-base) * 0.5);
    gap: 0.3em;
  }
  
  .presets-row {
    flex-wrap: wrap;
    gap: 0.3em;
  }
  
  .preset-button {
    padding: 0.4em 0.8em;
    font-size: 0.85em;
    min-width: 70px;
  }
  
  #pomodoroBar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: calc(var(--spacing-base) * 0.5);
  }
  
  .settings-button {
    bottom: 0.8em;
    right: 0.8em;
    padding: 0.25em 1em;
    font-size: 0.85em;
  }
}

@media (max-width: 360px) {
  :root {
    --timer-size-mobile: 140px;
  }
  
  #timerVisualText {
    font-size: 1.4em;
  }
  
  .presets-row button {
    width: 100%;
    margin: 0 0 0.5em 0;
  }
}

/* Dark mode overrides */
body.darkmode {
  background: var(--bg-dark);
  color: var(--text-dark);
}

body.darkmode #timerPanel {
  background: var(--panel-dark);
  box-shadow: 0 2px 16px var(--shadow-dark);
}

body.darkmode button:not(:disabled):hover {
  box-shadow: 0 2px 8px var(--shadow-dark);
}

.tabs {
  display: flex;
  justify-content: center;
  margin: 2rem 0 1rem 0;
}
.tabs button {
  background: none;
  border: none;
  padding: 0.7em 2em;
  font-size: 1.1em;
  cursor: pointer;
  color: inherit;
  border-bottom: 2px solid transparent;
  transition: border 0.2s;
}
.tabs button.active {
  border-bottom: 2px solid #0078d7;
}
body.darkmode .tabs button.active {
  border-bottom: 2px solid #4fc3f7;
}
.panel {
  max-width: 400px;
  margin: 0 auto 2rem auto;
  padding: 2em 1em 1em 1em;
  background: #fff;
  border-radius: 1em;
  box-shadow: 0 2px 16px rgba(0,0,0,0.07);
  transition: background 0.3s, color 0.3s;
}
body.darkmode .panel {
  background: #23272b;
  color: #e0e0e0;
  box-shadow: 0 2px 16px rgba(0,0,0,0.25);
}
.display {
  font-size: 2.2em;
  text-align: center;
  margin: 1.2em 0 1.2em 0;
  letter-spacing: 0.1em;
}
input[type="number"] {
  width: 2.5em;
  font-size: 1.1em;
  padding: 0.3em;
  border-radius: 0.3em;
  border: 1px solid #bbb;
  margin: 0 0.2em;
  background: #f9f9f9;
  color: inherit;
  transition: background 0.3s, color 0.3s;
}
body.darkmode input[type="number"] {
  background: #23272b;
  border: 1px solid #444;
  color: #e0e0e0;
}
button {
  background: #0078d7;
  color: #fff;
  border: none;
  border-radius: 0.3em;
  padding: 0.5em 1.2em;
  font-size: 1em;
  margin: 0.2em 0.2em 0.2em 0;
  cursor: pointer;
  transition: background 0.2s;
}
button:disabled {
  background: #aaa;
  cursor: not-allowed;
}
body.darkmode button {
  background: #4fc3f7;
  color: #181c1f;
}
button.preset {
  background: #e0e0e0;
  color: #222;
  border: 1px solid #bbb;
  margin-right: 0.5em;
}
body.darkmode button.preset {
  background: #333b41;
  color: #e0e0e0;
  border: 1px solid #444;
}
.hidden {
  display: none;
}
#darkmodeToggle {
  position: fixed;
  top: 1.2em;
  right: 1.2em;
  background: none;
  color: inherit;
  border: 1px solid #bbb;
  border-radius: 1.5em;
  padding: 0.3em 1.2em;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border 0.2s;
  z-index: 100;
}
body.darkmode #darkmodeToggle {
  border: 1px solid #444;
  background: #23272b;
  color: #e0e0e0;
}
body.darkmode .display {
  color: #e0e0e0;
}
body.darkmode .tabs button {
  color: #e0e0e0;
}
body.darkmode button:disabled {
  background: #444;
  color: #888;
  cursor: not-allowed;
}
#timeUpIndicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.65);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5em;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
#timeUpIndicator span {
  background: #0078d7;
  color: #fff;
  padding: 0.7em 2em;
  border-radius: 1em;
  box-shadow: 0 2px 16px rgba(0,0,0,0.18);
  border: 2px solid #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#timeUpIndicator small {
  font-size: 0.5em;
  margin-top: 0.5em;
  color: #fff;
  opacity: 0.8;
}
body.darkmode #timeUpIndicator span {
  background: #4fc3f7;
  color: #181c1f;
  border: 2px solid #23272b;
}
body.darkmode #timeUpIndicator small {
  color: #181c1f;
}
#timeUpIndicator.show {
  opacity: 1;
  pointer-events: auto;
}
.preset {
  background: #e0e0e0;
  color: #222;
  border: 1px solid #bbb;
  border-radius: 0.4em;
  margin: 0 0.4em 0 0;
  padding: 0.5em 1.2em;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border 0.2s;
}
body.darkmode .preset {
  background: #333b41;
  color: #e0e0e0;
  border: 1px solid #444;
}
.presets-row {
  display: flex;
  justify-content: center;
  gap: 0.4em;
  margin-bottom: 0.5em;
  text-align: center;
  flex-wrap: nowrap;
  max-width: 100%;
  align-items: center;
  overflow-x: auto;
  padding: 0.2em 0;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.presets-row::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.preset-button {
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 0.5em;
  padding: 0.4em 0.8em;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 70px;
  max-width: 120px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.preset-button:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 120, 215, 0.3);
}

body.darkmode .preset-button {
  background: var(--color-primary-dark);
}

body.darkmode .preset-button:hover {
  background: var(--color-primary);
  box-shadow: 0 2px 8px rgba(76, 195, 248, 0.3);
}

.preset-help {
  transition: opacity 0.2s;
}

.preset-help:hover {
  opacity: 0.8 !important;
}
#timerVisual {
  margin-bottom: 0.5em;
}
#timerForm {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  background: rgba(0,0,0,0.03);
  border-radius: 0.5em;
  padding: 0.7em 1em;
  margin: 0.5em 0 0.5em 0;
  flex-wrap: wrap;
  min-height: 60px;
}
#timerForm input[type="number"] {
  width: 2.5em;
  font-size: 1.1em;
  padding: 0.3em;
  border-radius: 0.3em;
  border: 1px solid #bbb;
  background: #f9f9f9;
  color: inherit;
  transition: background 0.3s, color 0.3s;
}
body.darkmode #timerForm input[type="number"] {
  background: #23272b;
  border: 1px solid #444;
  color: #e0e0e0;
}
#timerDisplay {
  font-size: 2.2em;
  text-align: center;
  margin: 0.7em 0 0.7em 0;
  letter-spacing: 0.1em;
}
#timerControls {
  display: flex;
  flex-direction: row;
  gap: 0.7em;
  justify-content: center;
  margin-top: 0.2em;
  margin-bottom: 0.2em;
}
#pomodoroBar {
  margin-bottom: 1em;
  width: 100%;
  text-align: center;
}
.pomodoro-mode {
  background: #e0e0e0;
  color: #222;
  border: 1px solid #bbb;
  margin-right: 0.5em;
  border-radius: 0.3em;
  padding: 0.5em 1.2em;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border 0.2s;
}
.pomodoro-mode.active {
  background: #0078d7;
  color: #fff;
  border: 2px solid #0078d7;
}
body.darkmode .pomodoro-mode {
  background: #333b41;
  color: #e0e0e0;
  border: 1px solid #444;
}
body.darkmode .pomodoro-mode.active {
  background: #4fc3f7;
  color: #181c1f;
  border: 2px solid #4fc3f7;
}
.visually-hidden {
  position: absolute;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: 0;
}

/* Keyboard shortcuts help overlay */
.keyboard-help-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease-out;
}

.keyboard-help {
  background: var(--panel-light);
  color: var(--text-light);
  border-radius: var(--border-radius);
  padding: 2em;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: slideIn 0.3s ease-out;
}

body.darkmode .keyboard-help {
  background: var(--panel-dark);
  color: var(--text-dark);
}

.keyboard-help h2 {
  margin: 0 0 1em 0;
  font-size: 1.5em;
}

.keyboard-help dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5em 1em;
  margin: 0;
}

.keyboard-help dt {
  text-align: right;
}

.keyboard-help kbd {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: 0.2em;
  padding: 0.2em 0.4em;
  font-family: monospace;
  font-size: 0.9em;
}

body.darkmode .keyboard-help kbd {
  background: var(--bg-dark);
  border-color: var(--border-dark);
}

.close-help {
  position: absolute;
  top: 1em;
  right: 1em;
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: inherit;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Settings button */
.settings-button {
  position: fixed;
  bottom: 1.2em;
  right: 1.2em;
  z-index: 100;
  background: var(--panel-light);
  color: var(--text-light);
  border: 1px solid var(--border-light);
  border-radius: 1.5em;
  padding: 0.3em 1.2em;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px var(--shadow-light);
}

.settings-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--shadow-light);
}

body.darkmode .settings-button {
  background: var(--panel-dark);
  color: var(--text-dark);
  border-color: var(--border-dark);
  box-shadow: 0 2px 8px var(--shadow-dark);
}

body.darkmode .settings-button:hover {
  box-shadow: 0 4px 12px var(--shadow-dark);
}

/* Unused CSS removed - theme and animation selection now uses <select> elements in settings modal */

/* Settings Modal */
.settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.settings-overlay.show {
  opacity: 1;
  visibility: visible;
}

.settings-modal {
  background: var(--panel-light);
  color: var(--text-light);
  border-radius: var(--border-radius);
  padding: 2em;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.settings-overlay.show .settings-modal {
  transform: translateY(0);
}

body.darkmode .settings-modal {
  background: var(--panel-dark);
  color: var(--text-dark);
}

.settings-modal h2 {
  margin: 0 0 1.5em 0;
  font-size: 1.8em;
  text-align: center;
}

.settings-close {
  position: absolute;
  top: 1em;
  right: 1em;
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: inherit;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.settings-close:hover {
  background: var(--bg-light);
}

body.darkmode .settings-close:hover {
  background: var(--bg-dark);
}

.settings-section {
  margin-bottom: 2em;
}

.settings-section h3 {
  margin: 0 0 1em 0;
  font-size: 1.2em;
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 0.5em;
}

body.darkmode .settings-section h3 {
  color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1em;
  padding: 0.5em 0;
}

.setting-label {
  font-weight: 500;
  margin-right: 1em;
}

.setting-control {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.setting-control input[type="checkbox"] {
  transform: scale(1.2);
}

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

.setting-control input[type="number"] {
  width: 80px;
  padding: 0.3em;
  border: 1px solid var(--border-light);
  border-radius: 0.3em;
  background: var(--bg-light);
  color: var(--text-light);
}

body.darkmode .setting-control input[type="number"] {
  border-color: var(--border-dark);
  background: var(--bg-dark);
  color: var(--text-dark);
}

.setting-control select {
  padding: 0.5em;
  border: 1px solid var(--border-light);
  border-radius: 0.3em;
  background: var(--bg-light);
  color: var(--text-light);
  min-width: 120px;
}

body.darkmode .setting-control select {
  border-color: var(--border-dark);
  background: var(--bg-dark);
  color: var(--text-dark);
}

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5em;
  background: var(--bg-light);
  border-radius: 0.5em;
  border: 1px solid var(--border-light);
  cursor: move;
  transition: all 0.2s ease;
  user-select: none;
}

.preset-item:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 4px var(--shadow-light);
}

.preset-item.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
  z-index: 1000;
}

.preset-item.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: white;
  transform: scale(1.02);
}

.preset-item.drag-over .preset-duration {
  color: white !important;
}

body.darkmode .preset-item {
  background: var(--bg-dark);
  border-color: var(--border-dark);
}

body.darkmode .preset-item:hover {
  border-color: var(--color-primary-dark);
  box-shadow: 0 2px 4px var(--shadow-dark);
}

body.darkmode .preset-item.drag-over {
  border-color: var(--color-primary-dark);
  background: var(--color-primary-dark);
}

.preset-drag-handle {
  color: var(--border-light);
  font-size: 1.2em;
  margin-right: 0.5em;
  cursor: grab;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.preset-drag-handle:hover {
  opacity: 1;
}

.preset-item:active .preset-drag-handle {
  cursor: grabbing;
}

body.darkmode .preset-drag-handle {
  color: var(--border-dark);
}

.quick-start-badge {
  background: var(--timer-success);
  color: white;
  font-size: 0.7em;
  padding: 0.2em 0.5em;
  border-radius: 1em;
  margin-left: 0.5em;
  font-weight: 500;
}

.preset-info {
  display: flex;
  align-items: center;
  gap: 1em;
  flex: 1;
}

.preset-name {
  font-weight: 500;
}

.preset-duration {
  color: var(--color-primary);
  font-size: 0.9em;
}

body.darkmode .preset-duration {
  color: var(--color-primary-dark);
}

.preset-actions {
  display: flex;
  gap: 0.5em;
}

.preset-btn {
  padding: 0.3em 0.8em;
  border: none;
  border-radius: 0.3em;
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.2s;
}

.preset-btn.edit {
  background: var(--color-primary);
  color: white;
}

.preset-btn.delete {
  background: var(--timer-danger);
  color: white;
}

.preset-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.add-preset-btn {
  background: var(--timer-success);
  color: white;
  border: none;
  padding: 0.8em 1.5em;
  border-radius: 0.5em;
  cursor: pointer;
  font-size: 1em;
  margin-top: 1em;
  transition: all 0.2s;
}

.add-preset-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.volume-display {
  min-width: 30px;
  text-align: center;
  font-size: 0.9em;
}

/* Service Worker Update Notification */
.update-notification {
  font-family: inherit;
}

.update-content {
  display: flex;
  align-items: center;
  gap: 1em;
  flex-wrap: wrap;
}

.update-btn, .dismiss-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.3em;
  padding: 0.4em 0.8em;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s;
}

.update-btn:hover, .dismiss-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.update-btn {
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-primary);
  font-weight: 500;
}

.update-btn:hover {
  background: white;
}

/* Error Recovery Notification Styles */
.recovery-notification {
  font-family: inherit;
}

.recovery-content {
  display: flex;
  align-items: center;
  gap: 1em;
  flex-wrap: wrap;
}

.recovery-icon {
  font-size: 1.2em;
  flex-shrink: 0;
}

.recovery-message {
  flex: 1;
  min-width: 200px;
}

.recovery-dismiss {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.3em;
  padding: 0.4em 0.8em;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.recovery-dismiss:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Mobile Enhancement Styles */
.mobile-enhanced {
  /* Optimize for touch interactions */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.mobile-enhanced button.mobile-optimized {
  /* Larger touch targets for mobile */
  min-height: 44px;
  min-width: 44px;
  padding: 0.6em 1.2em;
  font-size: 1em;
  border-radius: 0.5em;
  transition: all 0.2s ease;
}

.mobile-enhanced button.mobile-optimized:active {
  transform: scale(0.95);
  background: var(--color-primary-dark);
}

.mobile-enhanced input[type="number"] {
  /* Better mobile input experience */
  font-size: 16px; /* Prevents zoom on iOS */
  padding: 0.6em;
  border-radius: 0.4em;
  min-height: 44px;
  text-align: center;
}

.mobile-enhanced #timerVisual {
  /* Enhanced touch area for timer */
  cursor: pointer;
  transition: transform 0.2s ease;
}

.mobile-enhanced #timerVisual:active {
  transform: scale(0.98);
}

/* Gesture hint styles */
.gesture-hint {
  font-family: inherit;
  white-space: nowrap;
}

/* Keyboard open state adjustments */
.keyboard-open {
  /* Adjust layout when virtual keyboard is open */
}

.keyboard-open #timerPanel {
  margin-top: 1em;
  margin-bottom: 1em;
}

.keyboard-open .settings-button {
  bottom: 0.5em;
}

/* Touch-specific responsive improvements */
@media (max-width: 480px) and (pointer: coarse) {
  /* Styles specifically for touch devices */
  
  .mobile-enhanced #timerForm {
    padding: 1em;
    gap: 0.8em;
  }
  
  .mobile-enhanced #timerForm input[type="number"] {
    width: 3em;
    font-size: 1.2em;
  }
  
  .mobile-enhanced #timerControls {
    gap: 1em;
    margin-top: 1em;
  }
  
  .mobile-enhanced #timerControls button {
    flex: 1;
    min-height: 48px;
    font-size: 1.1em;
  }
  
  .mobile-enhanced .presets-row {
    gap: 0.8em;
    padding: 0.5em 0;
  }
  
  .mobile-enhanced .preset-button {
    min-height: 44px;
    padding: 0.6em 1em;
    font-size: 0.95em;
  }
  
  .mobile-enhanced #pomodoroBar {
    flex-wrap: wrap;
    gap: 0.8em;
    justify-content: center;
  }
  
  .mobile-enhanced .pomodoro-mode {
    min-height: 44px;
    padding: 0.6em 1.2em;
  }
  
  .mobile-enhanced .settings-modal {
    margin: 0.5em;
    max-height: 90vh;
    width: calc(100% - 1em);
  }
  
  .mobile-enhanced .setting-item {
    padding: 0.8em 0;
  }
  
  .mobile-enhanced .setting-control input,
  .mobile-enhanced .setting-control select,
  .mobile-enhanced .setting-control button {
    min-height: 44px;
  }
}

/* Landscape orientation optimizations for mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .mobile-enhanced #timerPanel {
    margin: 0.5em auto;
    padding: 1em;
  }
  
  .mobile-enhanced #timerVisual {
    width: 140px;
    height: 140px;
  }
  
  .mobile-enhanced #timerVisual svg {
    width: 140px;
    height: 140px;
  }
  
  .mobile-enhanced #timerVisualText {
    font-size: 1.4em;
  }
  
  .mobile-enhanced #pomodoroBar {
    margin-bottom: 0.5em;
  }
  
  .mobile-enhanced .settings-modal {
    max-height: 85vh;
  }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .mobile-enhanced #timerVisual svg {
    /* Crisp rendering on high DPI displays */
    shape-rendering: geometricPrecision;
  }
  
  .mobile-enhanced button {
    /* Prevent blurry text on high DPI */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Accessibility improvements for mobile */
@media (prefers-reduced-motion: reduce) {
  .mobile-enhanced * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .mobile-enhanced #timerVisual:active {
    transform: none;
  }
  
  .mobile-enhanced button:active {
    transform: none;
  }
}

@media (max-width: 600px) {
  .settings-modal {
    padding: 1.5em;
    margin: 1em;
  }
  
  .setting-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5em;
  }
  
  .setting-control {
    width: 100%;
    justify-content: flex-end;
  }
  
  .update-notification {
    left: 1em;
    right: 1em;
    transform: none;
    max-width: none;
  }
  
  .update-content {
    justify-content: center;
    text-align: center;
  }
}
