html,
body {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

* {
  box-sizing: border-box;
}

body {
  font-family: sans-serif;
  margin: 0;
  padding: 20px;
  padding-bottom: calc(168px + env(safe-area-inset-bottom));
  background: #f5f5f5;
  color: #222;
}

body.modal-open,
body.filter-modal-open {
  overflow: hidden;
}

body.screenshot-body-mode {
  overflow: hidden;
  padding: 0;
}

button,
input,
select,
textarea,
.card,
.leader-card,
.deck-card,
.image-only-card,
.action-button,
.color-button,
.checkbox-item,
.card-preview-modal,
.card-preview-content,
.card-preview-actions,
.screenshot-mode-section,
.bottom-tab-button,
.saved-deck-card,
.create-deck-fab,
.editor-select-button,
.editor-save-button,
.editor-back-button,
.selection-mode-back,
.selection-mode-done,
.filter-open-button,
.filter-modal-close,
#applyFilterButton,
#clearFiltersButton {
  touch-action: manipulation;
}

button,
.action-button,
.color-button,
.checkbox-item,
.bottom-tab-button,
.saved-deck-card,
.create-deck-fab,
.editor-select-button,
.editor-save-button,
.editor-back-button,
.selection-mode-back,
.selection-mode-done,
.filter-open-button,
.filter-modal-close,
#applyFilterButton,
#clearFiltersButton {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

h1 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 28px;
}

h2 {
  margin-top: 0;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #ddd;
  font-size: 20px;
}

section {
  padding: 15px;
  border-radius: 8px;
  background: white;
}

.cloud-status-panel,
.deck-library-section,
.deck-editor-section {
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
}

.cloud-status-panel {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-color: #b7d7ff;
  background: #eef6ff;
  color: #134a7c;
  font-weight: bold;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.selection-mode-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #111827;
  color: white;
}

.selection-mode-bar.is-active {
  display: flex;
}

.selection-mode-back,
.selection-mode-done,
.editor-back-button,
.editor-save-button {
  min-width: 64px;
  padding: 10px 14px;
  border: none;
  border-radius: 999px;
  font-weight: bold;
}

.selection-mode-back,
.editor-back-button {
  background: #333b4a;
  color: white;
}

.selection-mode-done,
.editor-save-button {
  background: #44529e;
  color: white;
}

.selection-mode-center {
  display: grid;
  gap: 4px;
  flex: 1;
  justify-items: center;
}

.selection-mode-title {
  font-size: 18px;
  font-weight: bold;
  line-height: 1.2;
}

.selection-mode-count {
  display: inline-grid;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  place-items: center;
  border-radius: 999px;
  background: #ff4a3d;
  color: white;
  font-weight: bold;
  font-size: 18px;
}

.search-section {
  margin-top: 0;
}

.fixed-search-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 8000;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-top: 1px solid #d6d6d6;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
}

.filter-open-button {
  height: 46px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: #111827;
  color: white;
  font-weight: bold;
  white-space: nowrap;
}

#searchInput {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 2px solid #0066cc;
  border-radius: 999px;
  outline: none;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  font-size: 16px;
}

#searchInput:focus {
  border-color: #004f9f;
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.18);
}

body.modal-open .fixed-search-bar,
body.screenshot-body-mode .fixed-search-bar,
.app-root.is-decks-tab .fixed-search-bar {
  display: none;
}

.filter-modal {
  position: fixed;
  inset: 0;
  z-index: 9700;
  display: none;
}

.filter-modal.is-open {
  display: block;
}

.filter-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.filter-modal-content {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #101116;
  color: #e8e8f0;
}

.filter-modal-header {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #3a3b45;
  background: #101116;
}

.filter-modal-close {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: #2d2f38;
  color: white;
  font-size: 28px;
  line-height: 44px;
}

.filter-modal-title {
  font-size: 22px;
  font-weight: bold;
  text-align: center;
  letter-spacing: 0.08em;
}

.filter-result-count {
  min-width: 58px;
  color: #d4d4dc;
  font-weight: bold;
  text-align: right;
}

.filter-modal-scroll {
  overflow: auto;
  padding-bottom: 16px;
}

.filter-block {
  padding: 22px 14px;
  border-bottom: 1px solid #3a3b45;
  text-align: center;
}

.filter-block-title {
  margin-bottom: 14px;
  color: #eeeeff;
  font-size: 22px;
  letter-spacing: 0.06em;
}

.filter-block select {
  width: min(420px, 100%);
  padding: 13px 14px;
  border: 1px solid #4c4d59;
  border-radius: 999px;
  background: #2a2b33;
  color: #f1f1f6;
  font-size: 16px;
  text-align: center;
}

.checkbox-actions,
.checkbox-list,
.color-button-list,
.filter-actions,
.card-preview-actions,
.deck-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-list,
.color-button-list {
  justify-content: center;
}

.checkbox-actions {
  justify-content: center;
  margin-bottom: 10px;
}

.checkbox-actions button,
#clearFiltersButton,
#applyFilterButton,
.action-button,
#deleteCurrentDeckButton,
#resetDeckButton,
#screenshotModeButton {
  border: none;
  border-radius: 999px;
  color: white;
  font-weight: bold;
}

.checkbox-actions button,
.action-button,
#screenshotModeButton {
  background: #444;
}

.checkbox-actions button {
  padding: 8px 14px;
  background: #3a3c47;
}

#deleteCurrentDeckButton,
#resetDeckButton,
.action-button.danger {
  background: #cc3333;
}

.action-button.primary {
  background: #0066cc;
}

#clearFiltersButton,
#applyFilterButton {
  min-width: 140px;
  padding: 14px 22px;
  background: #44529e;
  font-size: 17px;
}

#deleteCurrentDeckButton,
#resetDeckButton,
#screenshotModeButton {
  padding: 9px 12px;
  border-radius: 8px;
}

.action-button {
  padding: 9px 14px;
  border-radius: 8px;
}

.action-button:disabled,
#deleteCurrentDeckButton:disabled {
  background: #aaa;
  cursor: not-allowed;
}

.checkbox-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 44px;
  gap: 4px;
  padding: 8px 14px;
  border: 1px solid #4c4d59;
  border-radius: 999px;
  background: #2a2b33;
  color: #d9d9e4;
  font-size: 15px;
  cursor: pointer;
}

.checkbox-item input {
  margin: 0;
}

.checkbox-item:has(input:checked) {
  border-color: #8fa2ff;
  background: #44529e;
  color: white;
}

.range-filter {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  width: min(420px, 100%);
  margin: 0 auto;
}

.range-filter input {
  width: 100%;
  padding: 12px;
  border: 1px solid #4c4d59;
  border-radius: 999px;
  background: #2a2b33;
  color: #f1f1f6;
  font-size: 16px;
  text-align: center;
}

.color-button {
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  padding: 0;
  place-items: center;
  border: 4px solid transparent;
  border-radius: 999px;
  background: transparent;
}

.color-button.is-selected {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
}

.color-dot {
  display: block;
  width: 46px;
  height: 46px;
  border: 5px solid currentColor;
  border-radius: 999px;
  background: transparent;
}

.color-button-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: currentColor;
  font-weight: bold;
  font-size: 24px;
  line-height: 1;
}

.color-red { color: #ff3b35; }
.color-blue { color: #269df2; }
.color-green { color: #4fbd5b; }
.color-purple { color: #ad30c9; }
.color-black { color: #9b9b9b; }
.color-yellow { color: #ffeb37; }
.color-white { color: #ffffff; }
.color-other { color: #dddddd; }

.color-red .color-button-text::before { content: "R"; }
.color-green .color-button-text::before { content: "G"; }
.color-blue .color-button-text::before { content: "B"; }
.color-purple .color-button-text::before { content: "P"; }
.color-black .color-button-text::before { content: "K"; }
.color-yellow .color-button-text::before { content: "Y"; }

.color-button-text {
  font-size: 0;
}

.color-button-text::before {
  font-size: 24px;
}

.filter-modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  background: #eeeeee;
}

#cardList,
.editor-deck-grid,
.screenshot-deck-grid {
  display: grid;
  align-items: start;
}

#cardList {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.image-only-card {
  position: relative;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: none;
  border-radius: 8px;
  background: transparent;
  line-height: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
}

.card,
.leader-card,
.deck-card {
  transition: transform 0.12s, filter 0.12s;
}

.card:hover,
.leader-card:hover,
.deck-card:hover {
  transform: translateY(-3px);
  filter: brightness(1.05);
}

.card-image,
.leader-card-image,
.deck-card-image {
  display: block;
  width: 100%;
  background: #e5e5e5;
  pointer-events: none;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.leader-card {
  width: 100%;
  max-width: 210px;
  margin: 0 auto;
}

.card-count-badge,
.screenshot-count-badge {
  position: absolute;
  border-radius: 999px;
  background: #e60012;
  color: white;
  font-weight: bold;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.card-count-badge {
  top: -7px;
  right: -7px;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  font-size: 14px;
  line-height: 28px;
}

.image-missing {
  min-height: 120px;
  border: 1px dashed #aaa;
  border-radius: 8px;
  background: #eee;
}

.image-missing::after {
  content: "画像なし";
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  color: #777;
  font-size: 14px;
  line-height: 1.4;
}

.deck-view {
  display: none;
}

.deck-view.is-active {
  display: block;
}

.deck-library-section {
  padding: 15px;
}

.saved-decks-list {
  display: grid;
  gap: 12px;
}

.saved-decks-empty {
  padding: 24px;
  border: 1px dashed #ccc;
  border-radius: 12px;
  background: #fafafa;
  color: #555;
  line-height: 1.8;
  text-align: center;
}

.saved-deck-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  width: 100%;
  padding: 14px;
  border: 1px solid #ddd;
  border-radius: 14px;
  background: #fff;
  text-align: left;
}

.saved-deck-card:hover {
  border-color: #99b7ff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.saved-deck-image-wrap {
  display: grid;
  min-height: 128px;
  place-items: center;
}

.saved-deck-image {
  display: block;
  width: 100%;
  max-width: 86px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.saved-deck-image-placeholder {
  display: grid;
  width: 86px;
  min-height: 124px;
  padding: 8px;
  place-items: center;
  border: 1px dashed #aaa;
  border-radius: 10px;
  background: #f4f4f4;
  color: #666;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.saved-deck-body {
  display: grid;
  gap: 6px;
  align-content: start;
}

.saved-deck-name {
  font-size: 20px;
  font-weight: bold;
  line-height: 1.3;
}

.saved-deck-meta {
  color: #666;
  font-size: 14px;
}

.saved-deck-stats {
  margin-top: 2px;
  color: #222;
  font-size: 14px;
  font-weight: bold;
}

.create-deck-fab {
  position: fixed;
  right: 20px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 8400;
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: none;
  border-radius: 999px;
  background: #44529e;
  color: white;
  font-size: 42px;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

.deck-editor-section {
  padding: 15px;
}

.deck-editor-header {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

#deckNameInput {
  width: 100%;
  min-width: 0;
  padding: 12px 16px;
  border: 2px solid #ccc;
  border-radius: 999px;
  font-size: 18px;
}

.editor-count-badge {
  display: grid;
  min-width: 54px;
  height: 54px;
  padding: 0 14px;
  place-items: center;
  border-radius: 999px;
  background: #ff4a3d;
  color: white;
  font-weight: bold;
  font-size: 24px;
}

.deck-editor-main {
  display: grid;
  gap: 16px;
}

.editor-select-button {
  width: 100%;
  padding: 16px 18px;
  border: none;
  border-radius: 999px;
  background: #44529e;
  color: white;
  font-weight: bold;
  font-size: 20px;
}

.editor-leader-preview {
  min-height: 120px;
  padding: 12px;
  border: 1px dashed #c7cad7;
  border-radius: 12px;
  background: #fafbff;
}

.editor-leader-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  color: #666;
  text-align: center;
}

.editor-deck-info {
  color: #333;
  font-size: 15px;
  font-weight: bold;
}

.editor-deck-grid {
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  min-height: 100px;
}

.editor-empty-message {
  color: #666;
  font-size: 16px;
  line-height: 1.7;
}

.deck-editor-actions {
  margin-top: 6px;
}

.bottom-tab-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8500;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(72px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid #d8d8e5;
  background: rgba(20, 21, 28, 0.96);
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
}

.bottom-tab-button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: #a8a8b8;
  font-weight: bold;
}

.bottom-tab-button.is-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.bottom-tab-icon {
  font-size: 25px;
  line-height: 1;
}

.bottom-tab-label {
  font-size: 13px;
  line-height: 1;
}

.card-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.card-preview-modal.is-open {
  display: block;
}

.card-preview-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.card-preview-content {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: 16px auto;
  padding: 18px 64px;
  overflow: auto;
  border-radius: 12px;
  background: white;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.card-preview-close {
  position: sticky;
  top: 0;
  z-index: 4;
  float: right;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: #222;
  color: white;
  font-size: 24px;
  line-height: 36px;
}

.preview-nav-button {
  position: fixed;
  top: 50%;
  z-index: 10001;
  width: 48px;
  height: 70px;
  transform: translateY(-50%);
  border: none;
  border-radius: 12px;
  background: rgba(34, 34, 34, 0.88);
  color: white;
  font-size: 30px;
  font-weight: bold;
}

.preview-nav-button:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.preview-nav-prev { left: 8px; }
.preview-nav-next { right: 8px; }

.card-preview-layout {
  clear: both;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}

.card-preview-image-wrap {
  text-align: center;
}

.card-preview-image {
  width: 100%;
  max-width: 320px;
  border-radius: 10px;
  background: #eee;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

.card-preview-detail h3 {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.4;
}

.card-preview-info,
.card-preview-text {
  padding: 12px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.6;
}

.card-preview-info {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  background: #f6f6f6;
}

.card-preview-actions {
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  margin-bottom: 16px;
  padding: 10px;
  border-radius: 10px;
  background: #f7f7f7;
}

.preview-deck-count {
  width: 100%;
  color: #333;
  font-weight: bold;
  line-height: 1.4;
  text-align: center;
}

.card-preview-section {
  margin-top: 14px;
}

.card-preview-section h4 {
  margin: 0 0 6px;
  padding-left: 8px;
  border-left: 4px solid #333;
  font-size: 16px;
}

.card-preview-text {
  white-space: pre-wrap;
  border: 1px solid #ddd;
  background: #fafafa;
}

.screenshot-mode-section {
  display: none;
}

.app-root.screenshot-mode {
  height: 100vh;
  overflow: hidden;
}

.app-root.screenshot-mode > h1,
.app-root.screenshot-mode .cloud-status-panel,
.app-root.screenshot-mode #normalModeContent {
  display: none;
}

.app-root.screenshot-mode .screenshot-mode-section {
  display: block;
}

.screenshot-mode-section {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  padding: 8px;
  border-radius: 0;
  background: white;
}

.screenshot-header {
  display: flex;
  height: 54px;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
  margin-bottom: 6px;
}

.screenshot-header h2 {
  margin: 0 0 4px;
  padding: 0;
  border: none;
  font-size: 20px;
  line-height: 1.2;
}

.screenshot-stats {
  color: #333;
  font-size: 13px;
  font-weight: bold;
}

.screenshot-main-layout {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px;
  height: calc(100vh - 68px);
}

.screenshot-side-area {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  min-width: 0;
}

.screenshot-leader-box,
.screenshot-chart-box,
.screenshot-deck-box {
  min-width: 0;
  overflow: hidden;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
}

.screenshot-leader-box h3,
.screenshot-chart-box h3,
.screenshot-deck-box h3 {
  margin: 0 0 5px;
  font-size: 12px;
  line-height: 1.1;
}

.screenshot-leader-image {
  display: block;
  width: 100%;
  border-radius: 6px;
}

.screenshot-empty-leader,
.screenshot-empty-deck {
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #eee;
  color: #777;
}

.screenshot-empty-leader {
  height: 210px;
  border: 1px dashed #aaa;
  font-size: 12px;
}

.screenshot-deck-grid {
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 5px;
  align-content: start;
  height: calc(100% - 20px);
  overflow: hidden;
}

.screenshot-card-slot {
  position: relative;
  display: grid;
  aspect-ratio: 0.715 / 1;
  place-items: center;
  overflow: visible;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: #eee;
  color: #aaa;
  font-size: 11px;
}

.screenshot-card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
}

.screenshot-count-badge {
  top: -5px;
  right: -5px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  font-size: 12px;
  line-height: 22px;
}

.screenshot-empty-deck {
  grid-column: 1 / -1;
  height: 120px;
}

.cost-chart {
  display: grid;
  gap: 3px;
}

.cost-chart-row {
  display: grid;
  grid-template-columns: 22px 1fr 22px;
  gap: 4px;
  align-items: center;
  font-size: 11px;
}

.cost-chart-label,
.cost-chart-value {
  font-weight: bold;
  text-align: right;
}

.cost-chart-bar-wrap {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e8e8;
}

.cost-chart-bar {
  height: 100%;
  border-radius: 999px;
  background: #333;
}

@media (max-width: 900px) {
  body {
    padding: 12px;
    padding-bottom: calc(158px + env(safe-area-inset-bottom));
  }

  .fixed-search-bar {
    bottom: calc(68px + env(safe-area-inset-bottom));
    padding: 7px 8px;
    grid-template-columns: auto 1fr;
  }

  .filter-open-button {
    height: 44px;
    padding: 0 10px;
    font-size: 13px;
  }

  #searchInput {
    width: 100%;
    padding: 11px 13px;
  }

  h1 {
    font-size: 22px;
  }

  #cardList {
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
    gap: 10px;
  }

  .card-count-badge {
    min-width: 24px;
    height: 24px;
    font-size: 12px;
    line-height: 24px;
  }

  .filter-modal-header {
    grid-template-columns: 48px 1fr auto;
    padding: 10px;
  }

  .filter-modal-close {
    width: 40px;
    height: 40px;
    font-size: 24px;
    line-height: 40px;
  }

  .filter-modal-title {
    font-size: 20px;
  }

  .filter-block {
    padding: 20px 10px;
  }

  .filter-block-title {
    font-size: 21px;
  }

  .checkbox-item {
    min-width: 58px;
    min-height: 42px;
    padding: 8px 12px;
  }

  .color-button {
    width: 56px;
    height: 56px;
  }

  .color-dot {
    width: 44px;
    height: 44px;
  }

  .filter-modal-actions {
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  }

  #clearFiltersButton,
  #applyFilterButton {
    min-width: 118px;
    padding: 13px 18px;
  }

  .saved-deck-card {
    grid-template-columns: 76px 1fr;
    gap: 10px;
    padding: 12px;
  }

  .saved-deck-image,
  .saved-deck-image-placeholder {
    width: 72px;
  }

  .saved-deck-name {
    font-size: 18px;
  }

  .create-deck-fab {
    right: 14px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: 62px;
    height: 62px;
    font-size: 38px;
  }

  .deck-editor-header {
    grid-template-columns: auto 1fr auto;
  }

  .editor-save-button {
    grid-column: 1 / -1;
  }

  #deckNameInput {
    font-size: 16px;
  }

  .editor-count-badge {
    min-width: 48px;
    height: 48px;
    font-size: 22px;
  }

  .editor-select-button {
    font-size: 18px;
    padding: 14px 16px;
  }

  .editor-deck-grid {
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 8px;
  }

  .bottom-tab-nav {
    height: calc(68px + env(safe-area-inset-bottom));
  }

  .bottom-tab-icon {
    font-size: 23px;
  }

  .bottom-tab-label {
    font-size: 12px;
  }

  .card-preview-content {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    margin: 10px auto;
    padding: 12px 48px;
  }

  .card-preview-layout {
    grid-template-columns: 1fr;
  }

  .card-preview-image {
    max-width: 250px;
  }

  .preview-nav-button {
    width: 40px;
    height: 58px;
    font-size: 24px;
  }

  .preview-nav-prev { left: 2px; }
  .preview-nav-next { right: 2px; }

  .card-preview-detail h3 {
    font-size: 18px;
  }

  .card-preview-info,
  .card-preview-text {
    font-size: 14px;
  }

  .card-preview-actions {
    position: sticky;
    top: 0;
    z-index: 5;
  }

  .action-button {
    flex: 1 1 44%;
    padding: 10px 8px;
  }

  .screenshot-main-layout {
    grid-template-columns: 118px 1fr;
    gap: 5px;
  }

  .screenshot-header {
    height: 50px;
  }

  .screenshot-header h2 {
    font-size: 15px;
  }

  .screenshot-stats,
  #exitScreenshotModeButton {
    font-size: 11px;
  }

  #exitScreenshotModeButton {
    padding: 6px 8px;
  }

  .screenshot-mode-section {
    padding: 5px;
  }

  .screenshot-leader-box,
  .screenshot-chart-box,
  .screenshot-deck-box {
    padding: 4px;
  }

  .screenshot-leader-box h3,
  .screenshot-chart-box h3,
  .screenshot-deck-box h3 {
    margin-bottom: 3px;
    font-size: 10px;
  }

  .screenshot-deck-grid {
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 4px;
  }

  .screenshot-count-badge {
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    line-height: 18px;
  }

  .cost-chart-row {
    grid-template-columns: 18px 1fr 18px;
    gap: 3px;
    font-size: 9px;
  }

  .cost-chart-bar-wrap {
    height: 8px;
  }
}