@font-face {
  font-family: 'Berkeley Mono';
  src: url('https://static.due.ren/site/font/BerkeleyMono-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Berkeley Mono';
  src: url('https://static.due.ren/site/font/BerkeleyMono-Oblique.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Berkeley Mono';
  src: url('https://static.due.ren/site/font/BerkeleyMono-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Berkeley Mono';
  src: url('https://static.due.ren/site/font/BerkeleyMono-Bold-Oblique.otf') format('opentype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

:root {
  --font-family: 'Berkeley Mono', monospace;
  --line-height: 1.20rem;
  --border-thickness: 2px;
  --text-color: #000;
  --text-color-alt: #666;
  --background-color: #fff;
  --background-color-alt: #eee;
  --panel-background: #f7f7f9;
  --panel-border: rgba(0, 0, 0, 0.12);
  --panel-border-strong: rgba(0, 0, 0, 0.2);
  --panel-shadow: 0 30px 60px -40px rgba(15, 23, 42, 0.25);
  --accent-color: #0f172a;
  --accent-color-soft: rgba(15, 23, 42, 0.08);
  --accent-color-strong: rgba(15, 23, 42, 0.16);
  --highlight-border: rgba(15, 23, 42, 0.35);
  --highlight-background: rgba(15, 23, 42, 0.08);
  --interactive-fill: #0f172a;
  --interactive-fill-muted: rgba(15, 23, 42, 0.08);
  --interactive-contrast: #fff;
  --muted-border: rgba(0, 0, 0, 0.08);
  --focus-ring: rgba(15, 23, 42, 0.3);

  font-family: var(--font-family);
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 16px;
}

:root[data-theme='dark'] {
  --text-color: #f8fafc;
  --text-color-alt: #cbd5f5;
  --background-color: #060814;
  --background-color-alt: #091025;
  --panel-background: rgba(15, 23, 42, 0.65);
  --panel-border: rgba(148, 163, 184, 0.28);
  --panel-border-strong: rgba(148, 163, 184, 0.45);
  --panel-shadow: 0 30px 80px -40px rgba(2, 6, 23, 0.9);
  --accent-color: #67e8f9;
  --accent-color-soft: rgba(94, 234, 212, 0.18);
  --accent-color-strong: rgba(56, 189, 248, 0.35);
  --highlight-border: rgba(94, 234, 212, 0.45);
  --highlight-background: rgba(14, 165, 233, 0.22);
  --interactive-fill: rgba(94, 234, 212, 0.24);
  --interactive-fill-muted: rgba(148, 163, 184, 0.12);
  --interactive-contrast: #e0f2fe;
  --muted-border: rgba(148, 163, 184, 0.22);
  --focus-ring: rgba(94, 234, 212, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background: var(--background-color);
  color: var(--text-color);
}

body {
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
}

a {
  color: var(--accent-color);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

.site-header {
  padding: clamp(1.8rem, 6vw, 3rem) clamp(1.2rem, 4vw, 3.4rem);
  display: grid;
  grid-template-columns: minmax(200px, 2fr) auto minmax(200px, 2fr);
  align-items: end;
  gap: clamp(1rem, 4vw, 3rem);
  background: linear-gradient(120deg, var(--background-color-alt), var(--background-color));
  border-bottom: var(--border-thickness) solid var(--muted-border);
}

.brand h1 {
  font-size: clamp(2.1rem, 6vw, 3.2rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand p {
  margin-top: 0.5rem;
  max-width: 28rem;
  color: var(--text-color-alt);
}

.theme-toggle {
  justify-self: center;
  align-self: start;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: var(--border-thickness) solid var(--panel-border);
  background: var(--panel-background);
  color: var(--text-color);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.4s ease, color 0.4s ease;
  box-shadow: var(--panel-shadow);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent-color-strong);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.theme-toggle-icon {
  font-size: 1.25rem;
}

.theme-toggle-label {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.local-time {
  justify-self: end;
  text-align: right;
}

.local-time h2 {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-color-alt);
}

.time-display {
  font-size: clamp(4.2rem, 12vw, 7.8rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-top: 0.3rem;
}

.date-display,
.zone-display {
  margin-top: 0.3rem;
  font-weight: 500;
  color: var(--text-color-alt);
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(300px, 1fr);
  gap: clamp(1.8rem, 5vw, 3rem);
  padding: clamp(2rem, 5vw, 3.2rem) clamp(1.2rem, 4vw, 3.4rem);
  flex: 1;
}

.search-panel,
.comparisons {
  background: var(--panel-background);
  border: var(--border-thickness) solid var(--panel-border);
  border-radius: 18px;
  padding: clamp(1.2rem, 4vw, 1.8rem);
  backdrop-filter: blur(6px);
  box-shadow: var(--panel-shadow);
  transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

.search-panel h3,
.comparisons h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.search-panel h3 {
  margin-bottom: 0.8rem;
}

.search-input {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: 12px;
  border: var(--border-thickness) solid var(--muted-border);
  background: var(--background-color);
  color: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.4s ease, color 0.4s ease;
}

.search-input:focus {
  border-color: var(--accent-color);
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.search-results {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.6rem;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.search-result-item {
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  border: var(--border-thickness) solid transparent;
  background: var(--accent-color-soft);
  color: var(--text-color);
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.4s ease, color 0.4s ease;
}

.search-result-item:hover,
.search-result-item:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent-color-strong);
}

.search-result-item:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.search-result-item .result-name {
  font-weight: 600;
}

.search-result-item .result-zone {
  font-size: 0.85rem;
  color: var(--text-color-alt);
  margin-top: 0.25rem;
}

.search-result-item.is-selected {
  cursor: not-allowed;
  opacity: 0.45;
  border-color: var(--muted-border);
  background: var(--interactive-fill-muted);
}

.tips {
  margin-top: 1.3rem;
  font-size: 0.9rem;
  color: var(--text-color-alt);
  line-height: 1.4;
}

.comparisons {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.comparisons-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.time-converter {
  padding: 1.2rem;
  border-radius: 12px;
  background: var(--accent-color-soft);
  border: var(--border-thickness) solid var(--muted-border);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.time-converter-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.time-converter-mode {
  margin-bottom: 1rem;
}

.mode-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-color-alt);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.mode-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mode-button {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: var(--border-thickness) solid var(--muted-border);
  background: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-button:hover {
  border-color: var(--accent-color);
}

.mode-button.active {
  background: var(--interactive-fill);
  color: var(--interactive-contrast);
  border-color: var(--accent-color);
}

.mode-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.time-converter-base {
  margin-bottom: 1rem;
}

.time-converter-base label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-color-alt);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.timezone-select-wrapper {
  position: relative;
}

.timezone-search-input {
  width: 100%;
}

.timezone-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--background-color);
  border: var(--border-thickness) solid var(--muted-border);
  border-radius: 8px;
  margin-top: 0.3rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

.timezone-dropdown.active {
  display: block;
}

.timezone-option {
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid var(--muted-border);
  transition: background 0.15s ease;
}

.timezone-option:last-child {
  border-bottom: none;
}

.timezone-option:hover {
  background: var(--accent-color-soft);
}

.timezone-option.selected-zone {
  background: var(--highlight-background);
  border-left: 3px solid var(--highlight-border);
}

.timezone-option-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.timezone-option-tz {
  font-size: 0.8rem;
  color: var(--text-color-alt);
  margin-top: 0.2rem;
}

.timezone-group-header {
  padding: 0.5rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-color-alt);
  background: var(--accent-color-soft);
  border-bottom: 1px solid var(--muted-border);
  position: sticky;
  top: 0;
  z-index: 1;
}

.time-converter-inputs {
  display: none;
  margin-bottom: 1rem;
}

.time-converter-inputs.active {
  display: block;
}

.time-converter-field-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.time-converter-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.time-converter-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-color-alt);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.time-converter-input {
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: var(--border-thickness) solid var(--muted-border);
  background: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: border-color 0.2s ease, background 0.4s ease, color 0.4s ease;
}

.time-converter-input:focus {
  border-color: var(--accent-color);
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.time-converter-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.convert-button,
.clear-convert-button {
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  border: var(--border-thickness) solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.4s ease, color 0.4s ease;
}

.convert-button {
  background: var(--interactive-fill);
  color: var(--interactive-contrast);
}

.convert-button:hover,
.convert-button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent-color);
}

.clear-convert-button {
  background: var(--interactive-fill-muted);
  color: var(--text-color);
}

.clear-convert-button:hover,
.clear-convert-button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--muted-border);
}

.convert-button:focus-visible,
.clear-convert-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.reset-button {
  border: var(--border-thickness) solid transparent;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  background: var(--interactive-fill-muted);
  color: var(--text-color);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.4s ease, color 0.4s ease;
}

.reset-button:hover,
.reset-button:focus-visible {
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

.reset-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.table-headings {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.9fr;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-color-alt);
}

.selection-list {
  display: grid;
  gap: 0.9rem;
  list-style: none;
}

.selection-item {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.9fr auto;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: var(--border-thickness) solid transparent;
  background: var(--panel-background);
  box-shadow: var(--panel-shadow);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.4s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.selection-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent-color-strong);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.selection-item.highlight {
  border-color: var(--highlight-border);
  background: var(--highlight-background);
}

.selection-item .location-name {
  font-weight: 700;
}

.selection-item .location-meta {
  font-size: 0.85rem;
  color: var(--text-color-alt);
  margin-top: 0.2rem;
}

.selection-item .time-value {
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
  font-weight: 700;
}

.selection-item .offset-value {
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  color: var(--text-color-alt);
}

.remove-button {
  border: none;
  background: transparent;
  color: var(--text-color-alt);
  font-size: 1.1rem;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
}

.remove-button:hover,
.remove-button:focus-visible {
  color: var(--accent-color);
  transform: translateY(-1px);
}

.remove-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.site-footer {
  padding: 1.4rem clamp(1.2rem, 4vw, 3rem) 2.2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-color-alt);
}

@media (max-width: 1080px) {
  .site-header {
    grid-template-columns: 1fr;
    justify-items: flex-start;
    text-align: left;
  }

  .theme-toggle {
    justify-self: flex-start;
  }

  .local-time {
    justify-self: flex-start;
    text-align: left;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .selection-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .selection-item .time-value {
    font-size: 1.5rem;
  }

  .selection-item .offset-value {
    font-size: 1.05rem;
  }

  .table-headings {
    display: none;
  }
}
