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

:root {
  --font: "Figtree", system-ui, sans-serif;
  --radius: 2px;
  --radius-lg: 4px;
  --transition: 0.2s ease;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
}

button,
input {
  font: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.top-bar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 14px 8px 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.top-bar-spacer {
  width: 40px;
}

.brand--compact {
  flex-direction: row;
  gap: 0;
}

.brand--compact .brand-logo {
  height: 20px;
  max-width: 160px;
}

.brand--compact .brand-tag {
  display: none;
}

.sync-status {
  margin: 0;
  padding: 8px 16px;
  font-size: 11px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.sync-status--error {
  color: #a33;
}

.list-updated {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.sound-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.sound-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  min-width: 0;
  gap: 6px;
  color: var(--text);
}

.brand-logo {
  display: block;
  height: 22px;
  width: auto;
  max-width: min(200px, 100%);
  object-fit: contain;
}

.brand-tag {
  display: block;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: lowercase;
  line-height: 1.2;
}

.btn-ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color var(--transition), color var(--transition);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  padding: 14px 24px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  width: 100%;
  border-radius: var(--radius);
  transition: opacity var(--transition);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-outline {
  border: 1px solid var(--text);
  background: transparent;
  color: var(--text);
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--radius);
}

/* Design bar — vždy viditelný přepínač 3 variant */
.design-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 53px;
  z-index: 19;
}

.design-bar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

.design-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  flex: 1;
}

.design-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color var(--transition), transform var(--transition);
}

.design-tab:hover {
  border-color: var(--accent);
}

.design-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.design-tab-preview {
  width: 100%;
  height: 14px;
  border-radius: 1px;
}

.design-tab-preview.ocean {
  background: linear-gradient(90deg, #e8f2f8 0%, #1a4a6e 100%);
}

.design-tab-preview.minimal {
  background: linear-gradient(90deg, #fff 50%, #242424 50%);
}

.design-tab-preview.warm {
  background: linear-gradient(90deg, #faf6f0 0%, #6b4c3b 100%);
}

.design-tab.active .design-tab-preview {
  opacity: 0.85;
}

.design-tab-text {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Showcase na úvodní obrazovce */
.design-showcase {
  margin: 0 -16px 8px;
  padding: 20px 16px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.design-showcase-eyebrow {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.design-showcase-title {
  margin: 6px 0 0;
  font-size: 20px;
  font-weight: 600;
}

.design-showcase-desc {
  margin: 6px 0 14px;
  font-size: 13px;
  color: var(--muted);
}

.design-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.design-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 12px;
  align-items: center;
  padding: 12px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.design-card.active {
  border-color: var(--accent);
}

.design-card-preview {
  grid-row: 1 / 3;
  width: 56px;
  height: 44px;
  border-radius: var(--radius);
}

.design-card-preview.ocean {
  background: linear-gradient(145deg, #b8d4e8 0%, #1a4a6e 70%);
}

.design-card-preview.minimal {
  background: #fff;
  border: 2px solid #242424;
  box-shadow: inset 0 -12px 0 #242424;
}

.design-card-preview.warm {
  background: linear-gradient(145deg, #faf6f0 30%, #6b4c3b 100%);
}

.design-card strong {
  font-size: 14px;
  font-weight: 600;
}

.design-card span:last-child {
  font-size: 12px;
  color: var(--muted);
  grid-column: 2;
}

/* Main */
.main {
  flex: 1;
  padding: 0 16px 24px;
  padding-bottom: calc(24px + var(--safe-bottom));
}

.loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: var(--bg);
  z-index: 50;
  font-size: 13px;
  color: var(--muted);
}

.loading-logo {
  height: 28px;
  width: auto;
  max-width: min(240px, 85vw);
  object-fit: contain;
}

.loading.done {
  display: none;
}

/* Home */
.home-intro {
  text-align: center;
  padding: 28px 0 24px;
  margin-bottom: 8px;
}

.home-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  margin-bottom: 28px;
}

.home-brand-logo {
  display: block;
  height: 32px;
  width: auto;
  max-width: min(280px, 92vw);
  object-fit: contain;
}

.home-brand-tag {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: lowercase;
}

.home-title {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-transform: none;
}

.home-lead {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
}

.list-toolbar {
  margin-bottom: 22px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding: 4px 0 10px;
  margin-bottom: 14px;
}

.search-icon {
  flex-shrink: 0;
  color: var(--muted);
}

.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 4px 0;
  color: var(--text);
  outline: none;
  font-size: 15px;
}

.search-input::placeholder {
  color: var(--muted);
}

.filter-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
}

.segment-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 12px 10px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.segment-btn + .segment-btn {
  border-left: 1px solid var(--border);
}

.segment-btn.active {
  background: var(--accent);
  color: var(--accent-text);
}

.coffee-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 10px;
}

.coffee-grid .empty-state {
  grid-column: 1 / -1;
}

.coffee-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  border: none;
  background: var(--bg);
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
  overflow: hidden;
  transition: opacity var(--transition);
}

.coffee-card:hover,
.coffee-card:focus-visible {
  opacity: 0.92;
  outline: none;
}

.coffee-card--unavailable {
  opacity: 0.52;
}

.coffee-card--unavailable:hover,
.coffee-card--unavailable:focus-visible {
  opacity: 0.62;
}

.coffee-card-image-wrap {
  aspect-ratio: 1;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.coffee-card-image {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.coffee-card-image-placeholder {
  width: 48px;
  height: 48px;
  border: 1px dashed var(--border);
  border-radius: 50%;
  opacity: 0.4;
}

.coffee-card-body {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 72px;
}

.coffee-card h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.35;
}

.coffee-card-meta {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.coffee-card-profile {
  display: none;
}

.coffee-card .status-badge {
  margin-top: 6px;
}

.status-badge {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 6px;
  margin-top: auto;
  padding-top: 8px;
  align-self: flex-start;
}

.status-badge--soldout {
  background: var(--surface);
  color: var(--muted);
  border: none;
}

/* Detail */
.detail-header {
  display: grid;
  grid-template-columns: minmax(130px, 44%) 1fr;
  gap: 14px;
  align-items: start;
  margin-top: 28px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.detail-image-wrap {
  aspect-ratio: 1;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.detail-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.detail-info h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.detail-origin {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.detail-meta {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.detail-meta li {
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.detail-meta li:last-child {
  margin-bottom: 0;
}

.detail-meta li > span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section h3 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

.detail-item label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.detail-item span {
  font-size: 14px;
}

.detail-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.blend-hint {
  margin: 0 0 14px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
}

.blend-hint strong {
  font-weight: 600;
  color: var(--text);
}

.method-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.method-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 20px 14px 16px;
  cursor: pointer;
  text-align: center;
  color: inherit;
  transition: border-color var(--transition), background var(--transition);
}

.method-card:hover,
.method-card:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.method-card--recommended {
  border-width: 2px;
  border-color: var(--accent);
}

.method-card-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.method-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--accent);
  padding: 2px 6px;
}

.method-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  color: var(--text);
}

.method-icon svg {
  width: 52px;
  height: 52px;
}

.method-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.method-card strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.method-card-body > span {
  font-size: 11px;
  color: var(--muted);
}

/* Brew */
.brew-header {
  text-align: center;
  margin-top: 28px;
  padding: 16px 0 20px;
}

.brew-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.brew-header p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.params-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.param-pill {
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.param-pill strong {
  color: var(--accent);
  font-weight: 600;
}

/* Timer */
.timer-ring-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 28px;
}

.timer-ring {
  position: relative;
  width: 200px;
  height: 200px;
}

.timer-ring svg {
  transform: rotate(-90deg);
  width: 200px;
  height: 200px;
}

.timer-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 3;
}

.timer-ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s linear;
}

.timer-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-time {
  font-size: 42px;
  font-weight: 300;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.timer-label {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.step-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}

.step-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity var(--transition);
}

.step-item.done {
  opacity: 0.45;
}

.step-item.active {
  opacity: 1;
}

.step-num {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  border-radius: 50%;
}

.step-item.active .step-num {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.step-body h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.step-body p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.step-duration {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.timer-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.timer-controls .btn-outline {
  padding: 12px 8px;
  font-size: 11px;
}

.notes-box {
  border: 1px solid var(--border);
  padding: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  background: var(--surface);
}

.footer-cta {
  margin-top: 20px;
  padding-bottom: var(--safe-bottom);
}

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 14px;
}
