:root {
  color-scheme: light;
  --ink: #264820;
  --muted-ink: #426237;
  --paper: #fbf8ef;
  --line: #8ba278;
  --shadow: rgba(31, 51, 24, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", sans-serif;
}

.card-viewer {
  min-height: 100svh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
}

.card-image {
  display: block;
  width: min(100%, 1120px);
  max-height: calc(100svh - 104px);
  margin: 0 auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 12px 36px var(--shadow);
}

.actions {
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  justify-self: center;
  padding-bottom: max(0px, env(safe-area-inset-bottom));
}

.action-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 253, 245, 0.92);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.action-button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fffdf5;
}

.action-button:focus-visible {
  outline: 3px solid rgba(65, 106, 45, 0.38);
  outline-offset: 3px;
}

@media (max-width: 560px) {
  .card-viewer {
    padding: 10px;
    gap: 10px;
  }

  .card-image {
    max-height: calc(100svh - 116px);
  }

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