:root {
  --accent-start: #d51052;
  --accent-end: #6f3cab;
  --panel: #ffffff;
  --panel-border: rgba(15, 23, 42, 0.1);
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 24px;
  background: #ffffff;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
}

.page {
  display: grid;
  justify-items: start;
  gap: 18px;
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
}

.page-all {
  padding-bottom: 48px;
}

.toolbar {
  display: grid;
  gap: 14px;
  width: 100%;
}

.toolbar-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.variant-tabs,
.size-filters {
  display: flex;
  gap: 10px;
  align-items: center;
}

.variant-tabs {
  flex-wrap: nowrap;
}

.size-filters {
  flex-wrap: wrap;
}

.variant-tab,
.size-filter {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 0;
  background: #ffffff;
  color: #0f172a;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.variant-tab:hover,
.size-filter:hover {
  border-color: rgba(111, 60, 171, 0.35);
}

.variant-tab.is-active,
.size-filter.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-start) 0%, var(--accent-end) 100%);
  color: #ffffff;
}

.variant-tab:focus-visible,
.size-filter:focus-visible {
  outline: 3px solid rgba(111, 60, 171, 0.22);
  outline-offset: 3px;
}

.template-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 44px;
  width: 100%;
  align-items: start;
}

.template {
  display: grid;
  justify-items: start;
  gap: 8px;
  min-width: 0;
  align-content: start;
}

.template.is-hidden {
  display: none;
}

.size-label,
.template-meta {
  order: 0;
}

.size-label {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.template-meta {
  margin: 0 0 4px;
  color: rgba(15, 23, 42, 0.68);
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0.01em;
}

.download {
  order: 2;
  min-width: min(320px, calc(100vw - 48px));
  min-height: 52px;
  padding: 14px 22px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(135deg, var(--accent-start) 0%, var(--accent-end) 100%);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

.download:hover:not(:disabled) {
  transform: translateY(-1px);
}

.download:active:not(:disabled) {
  transform: translateY(0);
}

.download:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.download:focus-visible {
  outline: 3px solid rgba(111, 60, 171, 0.26);
  outline-offset: 4px;
}

.artboard-shell {
  order: 1;
  padding: 18px;
  border: 1px solid var(--panel-border);
  border-radius: 0;
  background:
    linear-gradient(45deg, rgba(15, 23, 42, 0.055) 25%, transparent 25%, transparent 75%, rgba(15, 23, 42, 0.055) 75%),
    linear-gradient(45deg, rgba(15, 23, 42, 0.055) 25%, transparent 25%, transparent 75%, rgba(15, 23, 42, 0.055) 75%),
    var(--panel);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 48px);
  max-height: none;
}

body[data-logo-variant="white"] .artboard-shell {
  background:
    linear-gradient(45deg, rgba(15, 23, 42, 0.12) 25%, transparent 25%, transparent 75%, rgba(15, 23, 42, 0.12) 75%),
    linear-gradient(45deg, rgba(15, 23, 42, 0.12) 25%, transparent 25%, transparent 75%, rgba(15, 23, 42, 0.12) 75%),
    #dbe2ea;
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
}

canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: min(1200px, calc(100vw - 84px));
  max-height: none;
  border-radius: 0;
  outline: 1px solid rgba(15, 23, 42, 0.12);
  background: transparent;
}

.page-all .download {
  width: 100%;
  min-width: 0;
}

.page-all .download-all {
  width: auto;
}

.download-all {
  order: 0;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  max-width: 100%;
  margin-left: auto;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #ffffff;
  color: #0f172a;
  box-shadow: none;
  white-space: nowrap;
}

.download-all:hover:not(:disabled) {
  transform: none;
  border-color: rgba(111, 60, 171, 0.38);
  background: rgba(111, 60, 171, 0.04);
}

.download-all:active:not(:disabled) {
  transform: none;
}

.download-all:disabled {
  border-color: rgba(15, 23, 42, 0.12);
}

.page-all .artboard-shell {
  width: 100%;
  max-width: none;
}

.page-all canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
}

@media (max-width: 1400px) {
  .template-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .template-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    padding: 16px;
  }

  .download {
    min-width: calc(100vw - 32px);
  }

  .toolbar-head {
    flex-direction: column;
    align-items: stretch;
  }

  .download-all {
    width: 100%;
    min-width: 0;
  }

  .variant-tabs,
  .size-filters {
    gap: 8px;
  }

  .variant-tab,
  .size-filter {
    min-height: 40px;
    padding: 9px 12px;
    font-size: 13px;
  }

  .template-list {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .artboard-shell {
    padding: 12px;
    border-radius: 0;
    max-width: calc(100vw - 32px);
  }

  canvas {
    max-width: calc(100vw - 56px);
    max-height: none;
  }
}
