/* ============================================
   AbesBigTimeiPad - iOS 12 compatible styles
   Flexbox only. No Grid, no :where/:is, no gap.
   ============================================ */

:root {
  --time-color: #ffffff;
  --date-color: #aaaaaa;
  --bg-color: #000000;
  --font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --accent-color: #4da6ff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: var(--font-family);
  background: var(--bg-color);
  color: var(--time-color);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* ============ Layout (landscape) ============ */

.app {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  height: 100vh;
  height: 100%;
  width: 100%;
}

/* ============ CSS immersive fullscreen fallback ============ */
/* Used when the Fullscreen API is unavailable or silently fails
   (e.g. Chrome iOS on WKWebView). Mimics fullscreen as closely as
   iOS allows: fills viewport, hides browser chrome, drops ad area. */

body.fs-immersive {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

body.fs-immersive .app {
  height: 100%;
  height: 100vh;
}

body.fs-immersive .ad-area {
  display: none;
}

/* ============ Clock area ============ */

.clock-area {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  position: relative;
  padding: 20px 40px;
}

.clock-wrap {
  text-align: center;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.time {
  font-size: 96px;
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: 2px;
  color: var(--time-color);
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: 'tnum';
  font-feature-settings: 'tnum';
  white-space: nowrap;
  text-shadow: 0 0 20px rgba(0,0,0,0.3);
}

/* Blink: hide colons via opacity so layout width stays fixed */
.time .colon {
  opacity: 1;
  position: relative;
  top: -0.05em;
  display: inline-block;
}

.time.blink-off .colon {
  opacity: 0;
}

.date {
  font-size: 22px;
  font-weight: 400;
  color: var(--date-color);
  letter-spacing: 1px;
  margin-top: 12px;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(0,0,0,0.3);
}

/* ============ Settings button ============ */

.settings-btn {
  position: absolute;
  top: 18px;
  width: 52px;
  height: 52px;
  border: none;
  background: transparent;
  color: var(--date-color);
  border-radius: 8px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  cursor: pointer;
  -webkit-transition: background 0.2s ease, color 0.2s ease;
  transition: background 0.2s ease, color 0.2s ease;
}

#fullscreen-btn {
  right: 82px;
}

#settings-btn {
  right: 18px;
}

.settings-btn:hover,
.settings-btn:active {
  background: rgba(255,255,255,0.1);
  color: var(--time-color);
}

.icon {
  display: block;
}

/* ============ Ad area (below clock) ============ */

.ad-area {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  flex: 0 0 auto;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 8px 16px 12px;
  min-height: 50px;
}

.ad-slot {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px dashed rgba(255,255,255,0.12);
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
}

.ad-slot::before {
  content: 'Advertisement';
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.25);
  text-transform: uppercase;
}

/* ============ Modal / Settings panel ============ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: end;
  -webkit-justify-content: flex-end;
  justify-content: flex-end;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  -webkit-backdrop-filter: blur(2px);
}

.settings-panel {
  position: relative;
  width: 380px;
  max-width: 85%;
  height: 100%;
  background: #14161a;
  color: #e8e8e8;
  box-shadow: -4px 0 24px rgba(0,0,0,0.5);
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-transform: translateX(0);
  transform: translateX(0);
  -webkit-transition: -webkit-transform 0.25s ease;
  transition: transform 0.25s ease;
}

.settings-header {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.settings-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.close-btn {
  width: 40px;
  height: 40px;
  font-size: 28px;
  line-height: 1;
  border: none;
  background: transparent;
  color: #e8e8e8;
  cursor: pointer;
  border-radius: 6px;
  -webkit-transition: background 0.15s ease;
  transition: background 0.15s ease;
}

.close-btn:hover,
.close-btn:active {
  background: rgba(255,255,255,0.1);
}

.settings-body {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px 20px;
}

.setting-group {
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 16px 0;
  margin: 0;
}

.setting-group legend {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #888;
  margin-bottom: 10px;
  padding: 0;
}

/* Segmented control */
.segmented {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.15);
}

.seg-btn {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  min-width: 56px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #aaa;
  background: transparent;
  border: none;
  border-right: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  -webkit-transition: background 0.15s ease, color 0.15s ease;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.seg-btn:last-child {
  border-right: none;
}

.segmented + .segmented {
  margin-top: 8px;
}

.seg-btn.active {
  background: var(--accent-color);
  color: #ffffff;
}

/* Toggle rows */
.toggle {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  padding: 8px 0;
  cursor: pointer;
}

.toggle input {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  -webkit-appearance: none;
  appearance: none;
  border: 2px solid #666;
  border-radius: 4px;
  background: transparent;
  position: relative;
  cursor: pointer;
}

.toggle input:checked {
  background: var(--accent-color);
  border-color: var(--accent-color);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M4 10l4 4 8-8'/%3E%3C/svg%3E");
  background-size: 80% 80%;
  background-position: center;
  background-repeat: no-repeat;
}

.toggle-label {
  font-size: 15px;
  color: #ddd;
}

/* Select */
select {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  background: #1c1f24;
  color: #e8e8e8;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  -webkit-appearance: none;
  appearance: none;
}

/* Range slider */
input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #333;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  border: none;
}

/* Color rows */
.color-row {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}

.color-item {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  margin-right: 18px;
  margin-bottom: 8px;
  font-size: 14px;
  color: #ccc;
}

.color-item input[type="color"] {
  width: 40px;
  height: 30px;
  border: none;
  border-radius: 6px;
  margin-left: 8px;
  cursor: pointer;
  padding: 0;
}

.gradient-row {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin-top: 10px;
}

.image-row {
  margin-top: 10px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
}

.image-row input[type="file"] {
  color: #ccc;
  font-size: 13px;
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
}

.small-btn {
  padding: 8px 14px;
  font-size: 13px;
  background: rgba(255,255,255,0.1);
  color: #e8e8e8;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  cursor: pointer;
  margin-left: 10px;
}

.settings-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
}

.reset-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  color: #ff6b6b;
  border: 1px solid rgba(255,107,107,0.4);
  border-radius: 8px;
  cursor: pointer;
  -webkit-transition: background 0.15s ease;
  transition: background 0.15s ease;
}

.reset-btn:hover,
.reset-btn:active {
  background: rgba(255,107,107,0.12);
}

/* ============ Per-section reset ============ */

.section-reset {
  display: block;
  margin-top: 12px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: transparent;
  color: var(--accent-color);
  border: 1px solid rgba(77,166,255,0.35);
  border-radius: 6px;
  cursor: pointer;
  -webkit-transition: background 0.15s ease;
  transition: background 0.15s ease;
}

.section-reset:hover,
.section-reset:active {
  background: rgba(77,166,255,0.12);
}

/* ============ Responsive (landscape tablet) ============ */

@media (max-height: 500px) {
  .time { font-size: 72px; }
  .date { font-size: 18px; }
}

@media (min-width: 1200px) {
  .time { font-size: 128px; }
}

/* ============ Orientation hint (portrait) ============ */

@media (orientation: portrait) {
  body::after {
    content: 'Please rotate to landscape';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    color: #fff;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    font-size: 22px;
    z-index: 9999;
  }
}

/* ============ Reduced motion ============ */

@media (prefers-reduced-motion: reduce) {
  .settings-panel {
    -webkit-transition: none;
    transition: none;
  }
}
