  :root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface2: #f0f0f3;
    --accent: #3d3d3d;
    --accent-color: #4a7c6f;
    --text: #222222;
    --text-dim: #888888;
    --border: #e0e0e0;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  html {
    overflow-x: hidden;
    width: 100%;
  }

  body {
    font-family: 'Noto Sans JP', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
  }

  .app {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px 20px;
    width: 100%;
    overflow-x: hidden;
  }

  .header {
    text-align: center;
    padding: 10px 0 8px;
  }

  .header h1 {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.5rem;
    /* font-size: 0.85rem; */
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.1em;
  }

  .header p {
    color: var(--text-dim);
    font-size: 1.3rem;
    /* font-size: 0.7rem; */
    margin-top: 2px;
    font-weight: 700;
    /* font-weight: 400; */
  }

  .layout {
    display: grid;
    grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    margin-top: 8px;
    width: 100%;
  }

  .tshirt-sticky {
    position: sticky;
    top: 10px;
    z-index: 10;
    min-width: 0;
  }

  @media (max-width: 720px) {
    .layout { grid-template-columns: 1fr; gap: 12px; }
    .app { padding: 8px; }
    .tshirt-sticky {
      position: sticky;
      top: -160px;
      background: var(--bg);
      padding: 4px 0 6px;
      z-index: 20;
    }
    .tshirt-card { padding: 6px; }
    .tshirt-wrapper { max-width: 280px; }
    .tshirt-card-label { font-size: 0.6rem; margin-bottom: 3px; }
    .panel { padding: 10px; }
    .color-row { gap: 4px; }
    .color-thumb-wrap { width: 28px; height: 28px; }
    .print-swatch { width: 20px; height: 20px; }
    .name-tag .name-edit { width: 60px; font-size: 0.68rem; }
    /* .header h1 { font-size: 0.78rem; } */
    /*.header p { font-size: 0.65rem; }*/
    .btn-export { font-size: 0.7rem; padding: 7px 10px; }
    .class-title-on-shirt { font-size: 12px; }
    .name-on-shirt { font-size: 7px; }
  }

  @media (max-width: 380px) {
    .tshirt-wrapper { max-width: 240px; }
    .tshirt-sticky { top: -130px; }
    .color-thumb-wrap { width: 24px; height: 24px; }
    .name-tag .name-edit { width: 50px; font-size: 0.62rem; }
  }

  .tshirt-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    overflow: hidden;
    min-width: 0;
  }

  .tshirt-card-label {
    font-size: 1.3rem;
    /* font-size: 0.68rem; */
    color: var(--text-dim);
    font-weight: 800;
    /* font-weight: 500; */
    letter-spacing: 0.06em;
    margin-bottom: 6px;
  }

  .tshirt-wrapper {
    position: relative;
    width: 100%;
    max-width: 390px;
    aspect-ratio: 1;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 6px;
  }

  .tshirt-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  img { max-width: 100%; }

  /* Color overlay for tinting */
  .tshirt-color-overlay {
    position: absolute;
    inset: 0;
    mix-blend-mode: screen;
    pointer-events: none;
    transition: background-color 0.3s;
  }

  .print-area {
    position: absolute;
    top: 17%;
    left: 22%;
    right: 22%;
    bottom: 10%;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
  }

  .names-overlay {
    width: 65%;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: center;
    overflow: hidden;
    padding: 2px;
    flex: 1;
  }

  .name-on-shirt {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    display: inline-block;
    flex-shrink: 0;
  }

  .class-title-on-shirt {
    text-align: center;
    font-weight: 900;
    font-size: 17px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: pre-line;
    line-height: 1.3;
    flex-shrink: 0;
    padding-bottom: 6px;
  }

  .logo-on-shirt {
    width: 60%;
    max-height: 22%;
    object-fit: contain;
    flex-shrink: 0;
    padding-bottom: 4px;
    margin-top: 8%;
  }

  .btn-export {
    background: #E91E63;
    color: #fffefe;
    border: none;
    width: 100%;
    padding: 12px;
    /* padding: 8px; */
    font-size: 1.5rem;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 600;
    text-align: center;
    animation: btnPulse 2s ease-in-out infinite;
    transition: transform 0.2s, box-shadow 0.2s;
  }
  /* .btn-export {
    margin-top: 8px;
    padding: 8px 14px;
    border: none;
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.2s;
  } */

  .btn-export:hover { opacity: 0.85; }

  .scroll-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    max-width: 100%;
  }

  .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    overflow: hidden;
    word-break: break-word;
  }

  .panel-title {
    font-size: 1.3rem;
    /* font-size: 0.75rem; */
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.02em;
  }

  .panel-title .icon { font-size: 0.85rem; }

  .customize-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
  }

  .customize-item label {
    display: block;
    font-size: 1.3rem;
    /* font-size: 0.68rem; */
    color: var(--text-dim);
    margin-bottom: 3px;
    font-weight: 700;
  }

  .customize-item select,
  .customize-item input[type="text"] {
    width: 100%;
    max-width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    color: var(--text);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.3rem;
    outline: none;
    transition: border-color 0.2s;
  }

  .customize-item select:focus,
  .customize-item input:focus { border-color: var(--accent-color); }

  .customize-item select option { background: var(--surface); }

  .color-row { display: flex; gap: 6px; flex-wrap: wrap; }

  /* Thumbnail with colorization */
  .color-thumb-wrap {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 5px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
  }

  .color-thumb-wrap:hover { transform: scale(1.08); }
  .color-thumb-wrap.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(0,0,0,0.1); }

  .color-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .color-thumb-wrap .thumb-overlay {
    position: absolute;
    inset: 0;
    mix-blend-mode: screen;
    pointer-events: none;
  }

  .print-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
  }

  .print-swatch:hover { transform: scale(1.15); }
  .print-swatch.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0,0,0,0.15); }

  .input-section label {
    display: block;
    font-size: 1.3rem;
    /* font-size: 0.68rem; */
    color: var(--text-dim);
    margin-bottom: 3px;
    font-weight: 500;
  }

  .name-input-row { display: flex; gap: 6px; max-width: 100%; }

  .name-input-row input {
    flex: 1;
    min-width: 0;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text);
    font-size: 1.3rem;
    /* font-size: 0.8rem; */
    font-family: 'Noto Sans JP', sans-serif;
    outline: none;
    transition: border-color 0.2s;
  }

  .name-input-row input:focus { border-color: var(--accent-color); }
  .name-input-row input::placeholder { color: #bbb; }

  .btn_classt {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 600;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    max-width: 100%;
  }
  /* .btn {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    max-width: 100%;
  } */

  .btn-add { background: var(--accent-color); color: #fff; }
  .btn-add:hover { opacity: 0.85; }

  .btn-upload {
    background: #E91E63;
    color: #fffefe;
    border: none;
    width: 100%;
    padding: 12px;
    /* padding: 8px; */
    font-size: 1.5rem;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 600;
    text-align: center;
    animation: btnPulse 2s ease-in-out infinite;
    transition: transform 0.2s, box-shadow 0.2s;
  }
  /* .btn-upload {
    background: #E91E63;
    color: #fffefe;
    border: none;
    width: 100%;
    margin-top: 8px;
    padding: 9px;
    font-size: 0.72rem;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 600;
    animation: btnPulse 2s ease-in-out infinite;
    transition: transform 0.2s, box-shadow 0.2s;
  } */

  .btn-upload:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.4);
    animation: none;
  }

  .btn-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
  }

  .divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    color: var(--text-dim);
    font-size: 1.3rem;
    font-weight: 600;
  }

  .divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
  }

  .names-list {
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 3px;
    display: flex;
    flex-wrap: wrap;
  }

  .names-list::-webkit-scrollbar { width: 3px; }
  .names-list::-webkit-scrollbar-track { background: transparent; }
  .names-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

  .name-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px 4px 2px 2px;
    margin: 2px;
    font-size: 1.0rem;
    /* font-size: 0.75rem; */
    transition: all 0.15s;
  }

  .name-tag:hover { border-color: var(--accent-color); }
  .name-tag:focus-within { border-color: var(--accent-color); background: #fff; }

  .name-tag .name-edit {
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 1.3rem;
    /* font-size: 0.75rem; */
    font-family: 'Noto Sans JP', sans-serif;
    width: 80px;
    max-width: 100%;
    padding: 2px 4px;
  }

  .name-tag .remove {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1;
    padding: 0 1px;
    transition: color 0.15s;
  }

  .name-tag:hover .remove { color: #e55; }
  .name-tag .remove:hover { color: #c00; }

  .badge {
    display: inline-block;
    background: var(--accent-color);
    color: #fff;
    font-size: 1.3rem;
    padding: 1px 6px;
    border-radius: 7px;
    font-weight: 600;
  }

  .btn-clear {
    background: none;
    border: none;
    color: #c44;
    cursor: pointer;
    font-size: 1.3rem;
    font-family: 'Noto Sans JP', sans-serif;
    padding: 2px 5px;
    border-radius: 4px;
    transition: background 0.15s;
  }

  .btn-clear:hover { background: #fff0f0; }

  .empty-state {
    text-align: center;
    padding: 20px 10px;
    color: var(--text-dim);
  }

  .empty-state .es-icon { font-size: 1.6rem; margin-bottom: 5px; }
  .empty-state p { font-size: 0.7rem; line-height: 1.6; }

  .hint { font-size: 1.3rem; color: var(--text-dim); margin-top: 4px; }

  .logo-title-area { margin-top: 3px; }

  .logo-preview-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    max-width: 100%;
    overflow: hidden;
  }

  .logo-preview-thumb {
    width: 36px;
    height: 24px;
    object-fit: contain;
    border-radius: 3px;
  }

  .logo-filename {
    font-size: 0.7rem;
    color: var(--text-dim);
  }

  .btn-logo-upload {
    background: #E91E63;
    color: #fffefe;
    border: none;
    width: 100%;
    padding: 12px;
    /* padding: 8px; */
    font-size: 1.5rem;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 600;
    text-align: center;
    animation: btnPulse 2s ease-in-out infinite;
    transition: transform 0.2s, box-shadow 0.2s;
  }

  .btn-logo-upload:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.4);
    animation: none;
  }

  .btn-logo-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
  }
  @keyframes btnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(233, 30, 99, 0.4); }
    50% { box-shadow: 0 0 12px 4px rgba(233, 30, 99, 0.25); }
  }