:root {
  --bg: #ffeee0;
  --surface: #ffffff;
  --text: #000000;
  --border: #000000;
}

* {
  box-sizing: border-box;
}

::selection {
  background: #000000;
  color: #ffffff;
}

::-moz-selection {
  background: #000000;
  color: #ffffff;
}

input::selection,
textarea::selection,
[contenteditable="true"]::selection {
  background: #000000 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff;
}

input::-moz-selection,
textarea::-moz-selection,
[contenteditable="true"]::-moz-selection {
  background: #000000 !important;
  color: #ffffff !important;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  font-family: "Schibsted Grotesk", "Helvetica Neue", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background-color 280ms ease;
}

body {
  overflow-x: hidden;
}

.prayer-app-container {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding-top: calc(28px + env(safe-area-inset-top));
  padding-right: calc(28px + env(safe-area-inset-right));
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
  padding-left: calc(28px + env(safe-area-inset-left));
  background: var(--bg);
  transition: background-color 280ms ease;
}

.prayer-app-main {
  width: 100%;
  max-width: 720px;
  display: flex;
}

.panel-card,
.prayer-card {
  width: 100%;
  min-height: calc(100dvh - 56px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0;
  border: 0;
  background: transparent;
}

.date-header {
  margin: 20px 0 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
}

.city-selector {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 12px;
  gap: 16px;
  padding: 16px 20px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  z-index: 10;
}

.location-icon {
  width: 34px;
  height: 34px;
  color: #1c1b22;
  flex: 0 0 auto;
}

.location-btn {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  border-radius: 8px;
}

.location-btn:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 2px;
}

.custom-select {
  width: 100%;
  position: static;
}

.custom-select input {
  width: 100%;
  border: 0;
  outline: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 500;
  padding: 0 128px 0 0;
}

.custom-select input::placeholder {
  color: #111111;
  opacity: 1;
}

.city-list {
  position: absolute;
  top: calc(100% + 2px);
  left: -2px;
  right: -2px;
  margin: 0;
  list-style: none;
  padding: 6px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  display: none;
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
}

.city-list.visible {
  display: block;
}

.city-item {
  cursor: pointer;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #000000;
}

.city-item:hover {
  background: #f1f1f1;
}

.city-main {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.city-sub {
  font-size: 13px;
  color: #555555;
}

.city-item--hint,
.city-item--hint:hover {
  cursor: default;
  background: transparent;
  color: #555555;
}

.digital-clock {
  display: inline-flex;
  align-items: center;
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  margin-top: 0;
  padding: 6px 12px;
  border: 2px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.1;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  pointer-events: none;
}

.prayer-subtitle {
  margin: 8px 0 10px;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 300;
  letter-spacing: 0;
}

.prayer-grid {
  display: grid;
  gap: 12px;
}

.prayer-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(100px, auto);
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: transparent;
}

.prayer-name {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 500;
  color: #000000;
  white-space: nowrap;
}

.prayer-time {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
  font-weight: 700;
  color: #000000;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  justify-self: center;
  text-align: center;
}

.prayer-countdown {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  font-weight: 400;
  color: #1a1a1a;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  justify-self: end;
  text-align: right;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.prayer-adhan-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  line-height: 1;
  flex-shrink: 0;
  vertical-align: middle;
  transform: translateY(-3px);
}

.prayer-adhan-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.prayer-next-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 14px;
  min-height: 28px;
  padding: 0 10px;
  border: 2px solid #ffffff;
  border-radius: 14px;
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #ffffff;
  vertical-align: middle;
  transform: translateY(-1.6px);
}

.prayer-item.is-next,
.prayer-item.is-now {
  background: #000000;
  border-color: #000000;
}

.prayer-item.is-next .prayer-name,
.prayer-item.is-next .prayer-time,
.prayer-item.is-next .prayer-countdown,
.prayer-item.is-now .prayer-name,
.prayer-item.is-now .prayer-time,
.prayer-item.is-now .prayer-countdown {
  color: var(--bg);
}

.prayer-item.is-next .prayer-countdown svg,
.prayer-item.is-now .prayer-countdown svg {
  color: currentColor;
}

.prayer-item.is-next .prayer-next-badge {
  border-color: var(--bg);
  color: var(--bg);
}

.prayer-item.is-now .prayer-next-badge {
  background: var(--bg);
  border-color: var(--bg);
  color: #000000;
}

.prayer-source {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: #000000;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100vw - 60px);
}

/* Large desktop proportions (match reference image scale) */
@media (min-width: 1200px) {
  .prayer-app-main {
    max-width: 690px;
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .prayer-app-container {
    padding-top: calc(14px + env(safe-area-inset-top));
    padding-right: calc(12px + env(safe-area-inset-right));
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    padding-left: calc(12px + env(safe-area-inset-left));
  }

  .panel-card,
  .prayer-card {
    min-height: auto;
    gap: 8px;
  }

  .prayer-subtitle {
    margin-top: 5vh;
  }

  .prayer-grid {
    gap: 8px;
  }

  .city-selector {
    padding: 10px 12px;
    gap: 10px;
  }

  .custom-select input {
    font-size: 18px;
    padding-right: 106px;
  }

  .location-icon {
    width: 24px;
    height: 24px;
  }

  .digital-clock {
    right: 14px;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 20px;
  }

  .prayer-item {
    padding: 10px 12px;
    border-width: 2px;
    gap: 10px;
  }

  .prayer-name {
    font-size: 20px;
  }

  .prayer-time {
    font-size: 18px;
    transform: translateX(20px);
  }

  .prayer-countdown {
    font-size: 16px;
  }

  .prayer-next-badge {
    font-size: 12px;
    min-height: 22px;
    border-width: 2px;
    border-radius: 11px;
    padding: 2px 8px;
    margin-left: 6px;
    transform: translateY(0);
  }

  .prayer-source {
    position: fixed;
    bottom: env(safe-area-inset-bottom, 12px);
    left: 50%;
    transform: translateX(-50%);
    border-width: 2px;
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 12px;
    margin-top: 0;
    text-align: center;
    z-index: 100;
  }
}
