/* ===================================================================
   Time Zone Converter — Cream world + tomato accent design system
   =================================================================== */

:root {
  --bg:           #faf6f1;
  --bg-2:         #f3eee5;
  --surface:      #ffffff;
  --surface-2:    #faf6ed;
  --surface-3:    #eee7d8;
  --border:       #e8dfcc;
  --border-soft:  #f0e9da;
  --text:         #1f1a14;
  --text-2:       #5c5547;
  --text-3:       #6e6557;
  --text-faint:   #b5ac9b;

  --accent:       #e85f4d;
  --accent-2:     #d44a39;
  --accent-soft:  rgba(232, 95, 77, 0.10);
  --accent-glow:  rgba(232, 95, 77, 0.55);

  --green:        #2e9a4b;
  --green-soft:   rgba(46, 154, 75, 0.18);
  --green-light:  rgba(46, 154, 75, 0.08);
  --green-border: rgba(46, 154, 75, 0.35);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 24px 48px rgba(0,0,0,0.12);

  --font-ui: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
             "PingFang TC", "PingFang SC", "Hiragino Sans", "Noto Sans CJK",
             sans-serif;
  --font-mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
html, body {
  font-family: var(--font-ui);
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 235, 220, 0.55) 0%, transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-2); }
ul, ol { list-style: none; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============ SKIP LINK ============ */
.skip-link {
  position: absolute;
  left: -9999px; top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  font-weight: 600;
  border-radius: 0 0 var(--r-sm) 0;
  z-index: 1000;
}
.skip-link:focus { left: 0; }

/* ============ APP CONTAINER ============ */
.app {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(12px, 3vw, 24px) clamp(12px, 3vw, 24px) 80px;
}

/* ============ TOPBAR ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px 28px;
}
.brand {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-2);
}
.brand:hover { color: var(--accent); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.nav-link:hover {
  color: var(--accent);
  background: var(--surface-2);
}

.lang-switcher {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 28px 6px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%237a7973' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  transition: border-color var(--transition);
}
.lang-switcher:hover { border-color: var(--text-3); }
.lang-switcher:focus { outline: none; border-color: var(--accent); }

/* ============ PAGE HEADER ============ */
.page-title {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 6px;
}
.page-sub {
  text-align: center;
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 28px;
}

/* ============ MODE TABS ============ */
.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px;
  width: max-content;
  margin: 0 auto 24px;
  box-shadow: var(--shadow-sm);
}
.mode-tab {
  padding: 14px 18px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-3);
  border-radius: var(--r-pill);
  transition: background var(--transition), color var(--transition);
}
.mode-tab:hover { color: var(--text); }
.mode-tab-active {
  background: var(--accent);
  color: #fff;
}
.mode-tab-active:hover { color: #fff; }
.mode-tab:active { transform: scale(0.96); }

/* ============ CONVERTER PANEL ============ */
.converter-panel {
  max-width: 860px;
  margin: 0 auto;
}

/* City card rows */
.city-cards {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 20px;
}
.city-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 20px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}
.city-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Search input */
.city-search {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--text);
  transition: border-color var(--transition);
  margin-bottom: 8px;
}
.city-search:focus { outline: none; border-color: var(--accent); }
.city-search::placeholder { color: var(--text-faint); }

/* Inline search dropdown */
.city-search-dropdown {
  position: absolute;
  top: 78px; left: 20px; right: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
}
.city-search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: background var(--transition);
}
.city-search-item:hover,
.city-search-item:focus,
.city-search-item-active {
  background: var(--accent-soft);
}
.city-search-name { font-weight: 600; color: var(--text); }
.city-search-tz { font-size: 11px; color: var(--text-3); }

/* City select list */
.city-select {
  width: 100%;
  flex: 1;
  min-height: 140px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px;
  font-size: 13px;
  color: var(--text);
  overflow-y: auto;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.city-select:focus { outline: none; border-color: var(--accent); }
.city-select option {
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.city-select option:checked {
  background: var(--accent);
  color: #fff;
}

/* Time display */
.time-display {
  font-family: var(--font-mono);
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin: 12px 0 4px;
  line-height: 1.1;
}
.time-date {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 2px;
}
.time-offset {
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 500;
}

/* Swap button */
.swap-col {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
}
.swap-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-3);
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.swap-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: rotate(180deg);
}

/* ============ TIME SLIDER ============ */
.slider-section {
  max-width: 520px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}
.slider-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.slider-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.time-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.time-slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(232, 95, 77, 0.35);
  transition: transform 0.15s ease;
}
.time-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.time-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(232, 95, 77, 0.35);
}
.slider-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-2);
  min-width: 80px;
  text-align: right;
  white-space: nowrap;
}
.slider-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.slider-btn {
  min-height: 44px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-pill);
  transition: background var(--transition), color var(--transition);
}
.slider-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ============ MEETING PLANNER ============ */
.meeting-panel {
  max-width: 860px;
  margin: 0 auto;
}

.meeting-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.meeting-cities {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.meeting-city-card {
  flex: 1;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.meeting-city-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.meeting-city-time {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--accent-2);
}
.meeting-city-date {
  font-size: 11px;
  color: var(--text-3);
}
.meeting-city-remove {
  position: absolute;
  top: 8px; right: 10px;
  width: 24px; height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-faint);
  border-radius: 50%;
  transition: background var(--transition), color var(--transition);
}
.meeting-city-remove:hover {
  background: rgba(232, 95, 77, 0.12);
  color: var(--accent);
}

.meeting-add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  border-radius: var(--r-pill);
  transition: background var(--transition), color var(--transition);
  align-self: flex-start;
}
.meeting-add-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* Meeting grid */
.meeting-grid-wrapper {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow-x: auto;
}

.overlap-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-light);
  border: 1px solid var(--green-border);
  border-radius: var(--r-pill);
  padding: 6px 16px;
  margin-bottom: 16px;
}
.overlap-badge.no-overlap {
  color: var(--text-3);
  background: var(--surface-2);
  border-color: var(--border);
}

/* 24-hour grid */
.meeting-grid {
  min-width: 600px;
}
.meeting-grid-ruler {
  display: grid;
  grid-template-columns: 120px repeat(24, 1fr);
  gap: 0;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 2px;
}
.meeting-grid-ruler span {
  text-align: center;
  padding: 2px 0;
}
.meeting-grid-ruler-label {
  font-weight: 600;
  color: var(--text-2);
}

.meeting-grid-row {
  display: grid;
  grid-template-columns: 120px repeat(24, 1fr);
  gap: 0;
  border-top: 1px solid var(--border-soft);
}
.meeting-grid-row:first-of-type { border-top: none; }

.meeting-grid-city-label {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-right: 1px solid var(--border-soft);
}

.meeting-grid-cell {
  height: 36px;
  border-right: 1px solid rgba(0,0,0,0.03);
  transition: background-color 0.15s ease;
}
.meeting-grid-cell.work {
  background: var(--accent-soft);
}
.meeting-grid-cell.overlap {
  background: var(--green-soft);
  border-right-color: rgba(46, 154, 75, 0.12);
}
.meeting-grid-cell.highlight {
  background: var(--accent-glow) !important;
}

/* Legend */
.meeting-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0 4px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
}
.legend-swatch {
  width: 16px; height: 16px;
  border-radius: 4px;
  flex: none;
}
.legend-work { background: var(--accent-soft); border: 1px solid var(--accent-glow); }
.legend-overlap { background: var(--green-soft); border: 1px solid var(--green-border); }
.legend-selected { background: var(--accent-glow); }

/* ============ INFO ============ */
.info {
  max-width: 720px;
  margin: 40px auto 0;
  padding: 0 4px;
}
.info h2 {
  font-size: clamp(18px, 4vw, 22px);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 26px 0 10px;
  color: var(--text);
}
.info p {
  font-size: 15px;
  color: var(--text-2);
  margin-bottom: 10px;
}

/* ============ FOOTER ============ */
.site-footer {
  max-width: 720px;
  margin: 56px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
  text-align: center;
}
.site-footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-3);
}
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--accent); }
.site-footer .sub {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-3);
}

/* ============ RESULT COPY ============ */
.result-copy {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  color: var(--text-3);
  transition: color var(--transition), background var(--transition);
  margin: 8px auto 0;
}
.result-copy:hover { color: var(--accent); background: var(--accent-soft); }
.result-copy.is-copied { color: var(--accent); background: var(--accent-soft); }

/* ============ RESPONSIVE ============ */
@media (max-width: 760px) {
  .city-cards {
    flex-direction: column;
    gap: 12px;
  }
  .swap-col {
    width: 100%;
    height: 20px;
  }
  .swap-btn {
    transform: rotate(90deg);
  }
  .swap-btn:hover {
    transform: rotate(270deg);
  }
  .meeting-cities {
    flex-direction: column;
  }
  .meeting-city-card {
    min-width: auto;
  }
  .meeting-legend {
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .topbar { padding: 4px 0 20px; }
  .city-card { padding: 12px 14px 16px; }
  .city-select { min-height: 100px; }
  .slider-section { padding: 16px; }
  .slider-row { gap: 10px; }
  .slider-value { font-size: 16px; min-width: 68px; }
}

@media (max-width: 480px) {
  .mode-tab { padding: 10px 14px; font-size: 13px; }
  .meeting-grid-wrapper { padding: 12px; }
}

@media (max-width: 420px) {
  .topbar-right .nav-link { display: none; }
  .topbar-right { gap: 6px; }
  .lang-switcher { max-width: 130px; font-size: 12px; padding: 4px 22px 4px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
