:root {
      color-scheme: light;
      --bg: #f6effc;
      --panel: #fbf7ff;
      --ink: #311e4d;
      --muted: #70598c;
      --line: #a783cf;
      --brand: #311e4d;
      --brand-strong: #311e4d;
      --accent: #6f3ca1;
      --shadow: 0 18px 44px rgba(49, 30, 77, 0.18);
      --radius: 8px;
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      min-height: 100vh;
      background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(246, 239, 252, 0) 340px),
        var(--bg);
      color: var(--ink);
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
      line-height: 1.65;
    }

    a {
      color: inherit;
    }

    button,
    input {
      font: inherit;
    }

    .visually-hidden {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    .site-shell {
      width: min(1120px, calc(100% - 32px));
      margin: 0 auto;
      padding: 28px 0 48px;
    }

    .site-header {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      gap: 20px;
      margin-bottom: 28px;
    }

    .brand-link {
      display: inline-grid;
      grid-template-columns: 52px minmax(0, auto);
      align-items: center;
      gap: 14px;
      max-width: 100%;
      text-decoration: none;
    }

    .brand-icon {
      width: 52px;
      height: 52px;
      border-radius: 8px;
      box-shadow: 0 10px 24px rgba(49, 30, 77, 0.24);
    }

    .brand-title {
      margin: 0;
      color: var(--brand-strong);
      font-size: clamp(1.55rem, 4vw, 2.35rem);
      font-weight: 800;
      letter-spacing: 0;
      line-height: 1.18;
      overflow-wrap: anywhere;
    }

    .author-link {
      display: inline-flex;
      align-items: center;
      min-height: 40px;
      padding: 8px 12px;
      border: 1px solid rgba(49, 30, 77, 0.34);
      border-radius: 8px;
      background: rgba(251, 247, 255, 0.78);
      color: var(--brand-strong);
      font-weight: 700;
      text-decoration: none;
      white-space: nowrap;
    }

    .author-link:hover,
    .author-link:focus-visible {
      border-color: var(--brand);
      background: var(--panel);
      outline: none;
    }

    .toolbar {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: center;
      margin: 0 0 18px;
    }

    .search-wrap {
      position: relative;
    }

    .search-wrap::before {
      position: absolute;
      left: 14px;
      top: 50%;
      width: 14px;
      height: 14px;
      border: 2px solid var(--muted);
      border-radius: 50%;
      content: "";
      transform: translateY(-55%);
      pointer-events: none;
    }

    .search-wrap::after {
      position: absolute;
      left: 27px;
      top: calc(50% + 7px);
      width: 8px;
      height: 2px;
      border-radius: 999px;
      background: var(--muted);
      content: "";
      transform: rotate(45deg);
      transform-origin: left center;
      pointer-events: none;
    }

    .search-input {
      width: 100%;
      min-height: 48px;
      padding: 10px 14px 10px 44px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      color: var(--ink);
      box-shadow: 0 10px 26px rgba(49, 30, 77, 0.1);
    }

    .search-input:focus {
      border-color: var(--brand);
      outline: 3px solid rgba(49, 30, 77, 0.22);
    }

    .result-count {
      color: var(--muted);
      font-size: 0.92rem;
      white-space: nowrap;
    }

    .tile-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
      gap: 16px;
      align-items: stretch;
    }

    .tile {
      display: grid;
      grid-template-rows: minmax(0, 7fr) minmax(0, 5fr);
      aspect-ratio: 1 / 1;
      min-height: 0;
      overflow: hidden;
      border: 1px solid rgba(49, 30, 77, 0.16);
      border-radius: var(--radius);
      background: var(--panel);
      box-shadow: 0 14px 34px rgba(49, 30, 77, 0.14);
      text-decoration: none;
      transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
    }

    .tile:hover,
    .tile:focus-visible {
      border-color: rgba(49, 30, 77, 0.62);
      box-shadow: var(--shadow);
      outline: none;
      transform: translateY(-2px);
    }

    .tile-thumb {
      display: block;
      grid-column: 1;
      grid-row: 1;
      width: 100%;
      height: 100%;
      min-height: 0;
      background: #e8d7f8;
      object-fit: cover;
    }

    .tile.fixed .tile-thumb {
      padding: 22px;
      object-fit: contain;
      background: #f1e6fb;
    }

    .tile-body {
      display: grid;
      grid-column: 1;
      grid-row: 2;
      align-content: start;
      gap: 6px;
      min-width: 0;
      min-height: 0;
      overflow: hidden;
      padding: 14px;
      background: var(--panel);
    }

    .tile-title {
      display: -webkit-box;
      margin: 0;
      overflow: hidden;
      color: var(--brand-strong);
      font-size: 1.05rem;
      font-weight: 800;
      line-height: 1.45;
      overflow-wrap: anywhere;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
    }

    .tile-summary {
      display: -webkit-box;
      margin: 0;
      overflow: hidden;
      color: var(--muted);
      font-size: 0.92rem;
      overflow-wrap: anywhere;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 3;
    }

    .empty-state {
      padding: 24px;
      border: 1px dashed rgba(49, 30, 77, 0.34);
      border-radius: 8px;
      color: var(--muted);
      background: rgba(251, 247, 255, 0.72);
    }

    .detail {
      display: grid;
      gap: 20px;
    }

    .back-link {
      justify-self: start;
      display: inline-flex;
      align-items: center;
      min-height: 40px;
      padding: 8px 12px;
      border: 1px solid rgba(49, 30, 77, 0.34);
      border-radius: 8px;
      background: var(--panel);
      color: var(--brand-strong);
      font-weight: 700;
      text-decoration: none;
    }

    .back-link:hover,
    .back-link:focus-visible {
      border-color: var(--brand);
      outline: none;
    }

    .detail-hero {
      display: grid;
      grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr);
      gap: 24px;
      align-items: start;
    }

    .detail-image {
      width: 100%;
      max-height: 620px;
      border-radius: 8px;
      background: #e8d7f8;
      box-shadow: var(--shadow);
      object-fit: cover;
    }

    .detail-image.icon-image {
      padding: 36px;
      background: #f1e6fb;
      object-fit: contain;
    }

    .detail-copy {
      display: grid;
      gap: 16px;
      min-width: 0;
      padding-top: 2px;
    }

    .detail-title {
      margin: 0;
      color: var(--brand-strong);
      font-size: clamp(1.75rem, 5vw, 3.1rem);
      line-height: 1.22;
      letter-spacing: 0;
      overflow-wrap: anywhere;
    }

    .detail-text {
      margin: 0;
      padding: 18px;
      border-left: 4px solid var(--accent);
      border-radius: 0 8px 8px 0;
      background: rgba(251, 247, 255, 0.88);
      color: var(--ink);
      font-size: 1rem;
      white-space: pre-wrap;
      overflow-wrap: anywhere;
    }

    @media (max-width: 760px) {
      .site-shell {
        width: min(100% - 24px, 1120px);
        padding-top: 18px;
      }

      .site-header,
      .toolbar,
      .detail-hero {
        grid-template-columns: 1fr;
      }

      .author-link,
      .result-count {
        justify-self: start;
      }

      .detail-copy {
        order: -1;
      }

      .brand-link {
        grid-template-columns: 44px minmax(0, 1fr);
      }

      .brand-icon {
        width: 44px;
        height: 44px;
      }

      .tile-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
        gap: 12px;
      }
    }
