/* Plain CSS only: no custom properties, no grid, kept simple for old
   Mobile Safari (iOS 9/10) rendering engines. */

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #000000;
  font-family: Helvetica, Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#timers {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-flex-direction: row;
  flex-direction: row;
}

.timer-col {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 0;
  flex: 1 1 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  border-right: 1px solid rgba(0,0,0,0.25);
  box-sizing: border-box;
  cursor: pointer;
}

.timer-col:last-child {
  border-right: none;
}

.timer-col.active {
  box-shadow: inset 0 0 0 6px rgba(255,255,255,0.85);
}

.timer-name {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 1vh;
  text-align: center;
  padding: 0 8px;
  word-break: break-word;
  max-width: 100%;
}

.timer-time {
  font-size: 60px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
  letter-spacing: 1px;
  white-space: nowrap;
  padding: 0 14px;
  box-sizing: border-box;
  max-width: 100%;
}

.timer-status {
  font-size: 16px;
  margin-top: 1vh;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Narrow / portrait phone-sized screens: stack columns instead of
   squeezing them side by side. iPads stay in row layout. */
@media (max-width: 560px) {
  #timers {
    -webkit-flex-direction: column;
    flex-direction: column;
  }
  .timer-col {
    border-right: none;
    border-bottom: 1px solid rgba(0,0,0,0.25);
  }
  .timer-col:last-child {
    border-bottom: none;
  }
}

#topBar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  height: 44px;
  z-index: 10;
  box-sizing: border-box;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-flex-direction: row;
  flex-direction: row;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
}

#totalGroup {
  position: relative;
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  min-width: 44px;
  height: 44px;
  box-sizing: border-box;
  border-radius: 22px;
  background-color: transparent;
  overflow: hidden;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-flex-direction: row;
  flex-direction: row;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-transition: background-color 0.2s ease, box-shadow 0.2s ease;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

#totalGroup.expanded {
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#totalContent {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-flex-direction: row;
  flex-direction: row;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  color: #111111;
  pointer-events: none;
  -webkit-transition: opacity 0.2s ease;
  transition: opacity 0.2s ease;
}

#totalGroup.expanded #totalContent {
  opacity: 1;
}

.icon-svg {
  display: block;
}

.icon-btn {
  height: 44px;
  min-width: 44px;
  border-radius: 22px;
  border: none;
  background-color: rgba(0,0,0,0.45);
  color: #ffffff;
  font-size: 20px;
  padding: 0;
  box-sizing: border-box;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-flex-direction: row;
  flex-direction: row;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

#settingsBtn {
  width: 44px;
  font-size: 22px;
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  flex: 0 0 auto;
  margin-left: 16px;
}

#totalBtn {
  width: 44px;
  margin-left: auto;
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  flex: 0 0 auto;
}

#totalGroup.expanded #totalBtn {
  background-color: transparent;
  color: #111111;
}

#totalBtn.active {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.9);
}

#totalGroup.expanded #totalBtn.active {
  box-shadow: 0 0 0 2px rgba(0,0,0,0.25);
}

.total-label {
  font-size: 14px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 10px;
  opacity: 0.6;
}

#totalContent #totalText {
  font-size: 20px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
  letter-spacing: 1px;
}

#settingsOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.6);
  z-index: 100;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
}

#settingsOverlay.hidden {
  display: none;
}

#settingsPanel {
  background-color: #ffffff;
  color: #111111;
  width: 90%;
  max-width: 520px;
  max-height: 85%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  padding: 20px;
  box-sizing: border-box;
}

#settingsPanel h2 {
  margin: 0 0 16px 0;
  font-size: 22px;
}

.count-row {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e0e0e0;
}

.count-label {
  font-size: 17px;
  font-weight: bold;
}

.stepper {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
}

.stepper-btn {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  border: 1px solid #cccccc;
  background-color: #f5f5f5;
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

.stepper-btn:disabled {
  opacity: 0.35;
}

#countDisplay {
  display: inline-block;
  min-width: 32px;
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  margin: 0 10px;
}

.config-row {
  padding: 12px 0;
  border-bottom: 1px solid #eeeeee;
}

.config-name {
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  padding: 8px;
  border: 1px solid #cccccc;
  border-radius: 6px;
  margin-bottom: 10px;
  -webkit-appearance: none;
}

.swatches {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 17px;
  margin: 0 8px 8px 0;
  border: 3px solid transparent;
  padding: 0;
}

.swatch.selected {
  border-color: #111111;
}

.swatch-custom {
  background-image: -webkit-linear-gradient(135deg, #c0392b 0%, #e0a72c 25%, #27ae60 50%, #2980b9 75%, #8e44ad 100%);
  background-image: linear-gradient(135deg, #c0392b 0%, #e0a72c 25%, #27ae60 50%, #2980b9 75%, #8e44ad 100%);
}

.color-picker {
  margin-top: 4px;
  padding: 10px;
  background-color: #f5f5f5;
  border-radius: 8px;
  box-sizing: border-box;
}

.color-picker.hidden {
  display: none;
}

.color-picker-top {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  margin-bottom: 10px;
}

.color-preview {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid #cccccc;
  margin-right: 10px;
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 36px;
  flex: 0 0 36px;
  box-sizing: border-box;
}

.color-hex {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  padding: 8px;
  border: 1px solid #cccccc;
  border-radius: 6px;
  -webkit-appearance: none;
  -webkit-user-select: text;
  user-select: text;
  font-family: Helvetica, Arial, sans-serif;
}

.color-sv-wrap {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
  cursor: crosshair;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.color-sv {
  display: block;
  width: 100%;
  height: 140px;
}

.color-sv-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  margin-top: -8px;
  border-radius: 8px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.45);
  pointer-events: none;
  box-sizing: border-box;
}

.color-hue-label {
  margin-top: 10px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
}

.color-hue {
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  background: -webkit-linear-gradient(left, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
  background: linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
  border-radius: 14px;
  outline: none;
}

.color-hue::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background-color: #ffffff;
  border: 2px solid #111111;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}

.color-hue::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background-color: #ffffff;
  border: 2px solid #111111;
}

.settings-actions {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-align-items: center;
  align-items: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #e0e0e0;
}

.primary-btn, .secondary-btn {
  font-size: 16px;
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
}

.primary-btn {
  background-color: #2c3e50;
  color: #ffffff;
  font-weight: bold;
}

.secondary-btn {
  background-color: #f0f0f0;
  color: #a03030;
}
