  body {
    margin: 0;
    font-family: Arial, "Microsoft JhengHei", sans-serif;
    background: #f5f5f5;
  }

  .container {
    max-width: 700px;
    margin: 0 auto;
    padding: 16px;
  }

  h1 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 8px;
  }

  .hint {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
  }

  .form-group {
    margin-bottom: 16px;
  }

  .top-control-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 12px;
    align-items: end;
  }

  .hidden-file-input {
    display: none;
  }

  .file-button {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    font-size: 20px;
    text-align: center;
    border-radius: 8px;
    background: #333;
    color: white;
    cursor: pointer;
    margin-bottom: 6px;
  }

  .file-name-text {
    font-size: 14px;
    color: #555;
    word-break: break-all;
  }

  .frame-gallery {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .frame-card {
    flex: 0 0 120px;
    background: white;
    border: 3px solid transparent;
    border-radius: 12px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
  }

  .frame-card img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    display: block;
    margin-bottom: 6px;
  }

  .frame-card-name {
    font-size: 14px;
    font-weight: bold;
  }

  .frame-select-hidden {
    display: none;
  }

  .category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .category-tab {
    flex: 0 0 auto;
    padding: 10px 16px;
    border-radius: 999px;
    border: none;
    background: #ddd;
    color: #333;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
  }

  .category-tab.active {
    background: #0b6bcb;
    color: white;
  }

  .frame-card {
    background: white;
    border: 3px solid transparent;
    border-radius: 12px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
  }

  .frame-card.active {
    border-color: #0b6bcb;
    background: #eef6ff;
  }

  .frame-card img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    display: block;
    margin-bottom: 6px;
  }

  .frame-card-name {
    font-size: 16px;
    font-weight: bold;
  }

  label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
  }

  input[type="text"],
  textarea,
  input[type="file"],
  textarea,
  select {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    font-size: 22px !important;
    min-height: 56px;
    border-radius: 8px;
  }

  input[type="range"] {
    width: 100%;
  }

  .canvas-wrap {
    width: 100%;
    background: #ddd;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    touch-action: auto;
  }

  canvas {
    width: 100%;
    height: auto;
    display: block;
    background: white;
  }

  .button-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
  }

  button {
    flex: 1;
    padding: 14px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background: #333;
    color: white;
  }

  .submit-btn {
    width: 100%;
    margin-top: 12px;
    background: #28a745;
    font-weight: bold;
  }

  .submit-btn:disabled {
    background: #999;
  }

  .result-box {
    margin-top: 16px;
    padding: 16px;
    background: #fff8d6;
    border: 1px solid #e0c35a;
    border-radius: 8px;
    line-height: 1.8;
    font-size: 16px;
  }

  .admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
  }

  .admin-container h1 {
    text-align: center;
  }

  .admin-container h2 {
    margin-top: 28px;
    border-bottom: 2px solid #333;
    padding-bottom: 6px;
  }

  .admin-button-row {
    margin: 16px 0;
  }

  .order-list {
    display: grid;
    gap: 12px;
  }

  .order-card {
    background: white;
    border-radius: 10px;
    padding: 14px;
    border: 1px solid #ddd;
    line-height: 1.8;
  }

  .order-title {
    grid-column: 1 / -1;
    font-weight: bold;
    font-size: 22px;
    margin-bottom: 6px;
  }

  .card-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
  }

  .card-actions button {
    flex: none;
    padding: 8px 12px;
    font-size: 14px;
  }

  .empty-text {
    color: #777;
    background: white;
    padding: 12px;
    border-radius: 8px;
  }

  .compact-card {
    display: flex;
    gap: 18px;
    align-items: flex-start;
  }

  .card-left {
    width: 140px;
    flex-shrink: 0;
  }

  .card-right {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 6px 20px;
    align-items: start;
  }

  .thumb-wrap {
    width: 120px;
    height: 180px;
    background: #eee;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
  }

  .order-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .status-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin: 20px 0;
  }

  .status-tab {
    padding: 14px 10px;
    font-size: 18px;
    border-radius: 10px;
    background: #ddd;
    color: #333;
    border: none;
    cursor: pointer;
  }

  .status-tab.active {
    background: #0b6bcb;
    color: white;
    font-weight: bold;
  }

  .tool-section {
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
  }

  .tool-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
  }

  .single-button-row button {
    max-width: 100%;
  }

  .test-section {
    background: #f9f9f9;
    border-style: dashed;
  }

  .search-box {
    display: flex;
    gap: 10px;
    margin: 16px 0;
  }

  .search-box input {
    flex: 1;
    padding: 12px;
    font-size: 16px;
    box-sizing: border-box;
  }

  .search-box button {
    flex: none;
    padding: 12px 18px;
    font-size: 16px;
  }

  .small-preview-btn {
    display: block;
    width: 120px;
    margin-top: 6px;
    padding: 8px 10px;
    font-size: 14px;
    border-radius: 6px;
    background: #555;
    color: white;
    border: none;
    cursor: pointer;
  }

  .preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

  .preview-box {
    background: white;
    border-radius: 12px;
    padding: 12px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    text-align: center;
  }

  .preview-large-img {
    max-width: 85vw;
    max-height: 80vh;
    object-fit: contain;
    display: block;
  }

  .preview-close-btn {
    margin-bottom: 10px;
    padding: 10px 16px;
    font-size: 16px;
    background: #333;
    color: white;
    border-radius: 8px;
  }

  #frameSelect {
    font-size: 18px !important;
  }

  select,
  select option {
    font-size: 18px !important;
  }

  .accordion-btn {
    width: 100%;
    background: #0b6bcb;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
  }

  .accordion-panel {
    display: none;
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
  }

  .accordion-panel.open {
    display: block;
  }

  .test-accordion-btn {
    background: #777;
  }

  .preview-layout {
    display: grid;
    grid-template-columns: 1fr 110px;
    gap: 10px;
    align-items: start;
  }

  .object-selector {
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 10px;
  }



  .object-btn {
    width: 100%;
    margin-bottom: 6px;
    padding: 10px 6px;
    font-size: 14px;
    border-radius: 8px;
    background: #ddd;
    color: #333;
  }

  .object-list-row {
    display: block;
  }

  .object-list-separator {
    border-top: 1px solid #ddd;
    margin: 10px 0;
  }

  .mobile-edit-mode-btn {
    display: none;
  }

  .object-btn.active {
    background: #0b6bcb;
    color: white;
  }

  .object-btn:disabled {
    background: #eee;
    color: #aaa;
  }

  .object-control-box {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
  }

  .object-layer-box {
    margin-top: 12px;
    margin-bottom: 12px;
  }

  .object-control-label {
    display: block;
    font-size: 14px;
    font-weight: bold;
    margin-top: 8px;
    margin-bottom: 4px;
  }

  .object-control-box input[type="range"] {
    width: 100%;
  }

  .object-button-row button {
    min-height: 44px;
    font-size: 22px;
    padding: 8px;
  }

  #resetBtn,
  #deleteObjectBtn {
    font-size: 16px !important;
    font-weight: bold;
  }

  .delete-object-btn {
    background: #c0392b;
    color: white;
    font-size: 10px;
  }

  textarea {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    padding: 12px;
    font-size: 20px;
    border-radius: 8px;
    min-height: 90px;
  }

  .current-object-name {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #0b6bcb;
    margin-bottom: 12px;
  }

  .panel-target-label {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    font-size: 14px;
  }

  .sticker-btn {
    flex: 1;
    background: #333;
    color: white;
    font-size: 18px;
    border-radius: 8px;
  }

  .sticker-btn.emoji-sticker-btn {
    background: white;
    color: #333;
    border: 1px solid #ddd;
  }

  .sticker-category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 10px;
  }

  .emoji-sticker-btn {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    min-height: 64px;
    padding: 0;

    background: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 12px;

    font-size: 34px;
    line-height: 1;

    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sticker-category-btn {
    flex: 0 0 auto;
    padding: 10px 14px;
    border-radius: 999px;
    background: #ddd;
    color: #333;
    font-size: 16px;
    font-weight: bold;
  }

  .sticker-category-btn.active {
    background: #0b6bcb;
    color: white;
  }

  .sticker-row {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
  }

  .quick-sticker-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .sticker-btn {
    background: #333;
    color: white;
    border-radius: 8px;

    min-height: 50px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    font-size: 14px;
    padding: 6px;
  }

  .object-divider {
    border-top: 1px solid #ddd;
    margin: 10px 0;
  }

  #moveUpBtn:disabled,
  #moveDownBtn:disabled {
    background: #ddd;
    color: #aaa;
  }

  .full-frame-preview {
    height: 120px;
    border-radius: 8px;
    background: #f1f1f1;
    border: 2px dashed #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 20px;
    font-weight: bold;
  }

  .png-sticker-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, 150px);
    gap: 8px;
    justify-content: start;
  }

  .png-sticker-card {
    width: 150px;
    min-height: 210px;
    padding: 6px;
    box-sizing: border-box;
  }

  .png-sticker-card img {
    width: 100%;
    height: 155px;
    object-fit: contain;
  }

  .png-sticker-name {
    margin-top: 6px;
    font-size: 15px;
    text-align: center;
  }

  .text-update-disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .edit-mode-btn {
    width: 100%;
    margin-bottom: 6px;
    background: #6c757d;
    color: white;
    font-weight: bold;
  }

  .edit-mode-btn.active {
    background: #ff9800;
    color: white;
  }



  .canvas-wrap.editing {
    touch-action: none;
  }

  .text-style-direction-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 10px;
    align-items: end;
  }

  .text-style-box,
  .text-direction-box {
    margin-bottom: 16px;
  }

  .text-direction-buttons {
    display: flex;
    gap: 6px;
  }

  .text-direction-btn {
    min-height: 56px;
    padding: 8px;
    font-size: 16px;
    background: #ddd;
    color: #333;
  }

  .text-direction-btn.active {
    background: #0b6bcb;
    color: white;
  }

  button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  input:disabled {
    opacity: 0.5;
  }

  .edit-mode-btn {
    width: 100%;
    min-height: 72px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    font-size: 18px;
    font-weight: bold;
    line-height: 1.2;
  }

  .edit-mode-icon {
    display: block;
    font-size: 22px;
  }

  .edit-mode-text {
    display: block;
    white-space: nowrap;
  }

  .object-usage-info {
    margin: 10px 0;
    padding: 8px;

    text-align: center;

    background: #f5f7fa;
    border: 1px solid #dfe3e8;
    border-radius: 8px;

    font-size: 13px;
    font-weight: 600;
    color: #555;
  }

  .text-label-row {
    display: grid;
    grid-template-columns: 1fr 160px;
    gap: 10px;
    align-items: center;
    margin-bottom: 6px;
  }

  .text-label-row label {
    margin-bottom: 0;
  }

  .text-template-select {
    font-size: 16px !important;
    min-height: 42px !important;
    padding: 6px 8px !important;
  }

  .edit-mode-hint {
    margin-top: 10px;
    padding: 8px 12px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    color: #8d6e63;
    font-size: 14px;
  }

  .object-selector-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
    text-align: center;
    color: #333;
  }

  .photo-button-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
  }

  .photo-button-row .file-button {
    flex: 1;
    text-align: center;
  }







  /* 手機 / 平板觸控版介面 */
  @media (max-width: 1000px) {

    .mobile-edit-mode-btn {

      display: block;

      position: fixed;

      right: 15px;
      bottom: 15px;

      width: 150px;
      height: 75px;

      z-index: 9999;

      border-radius: 999px;

      background: #6c757d;
      color: white;

      font-size: 22px;
      font-weight: bold;

      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .mobile-edit-mode-btn.active {
      background: #ff9800;
    }

    .text-label-row {
      grid-template-columns: 1fr;
      gap: 6px;
    }

    .text-template-select {
      font-size: 18px !important;
      min-height: 54px !important;
    }

    .png-sticker-gallery {
      display: grid;
      grid-template-columns: repeat(auto-fill, 280px);
      /* 每個格子有多寬 */
      gap: 5px;
      justify-content: start;
    }

    .png-sticker-card {
      width: 100%;
      min-height: 280px;
      /*格子裡的卡片有多大*/
      padding: 6px;
      box-sizing: border-box;
    }

    .png-sticker-card img {
      width: 100%;
      height: 260px;
      /*這個才是圖片有多大的地方*/
      object-fit: contain;
      display: block;
    }

    .png-sticker-name {
      margin-top: 6px;
      font-size: 15px;
      font-weight: bold;
      text-align: center;
    }

    .sticker-row {
      display: grid;
      grid-template-columns: repeat(auto-fill, 70px);
      gap: 5px;
    }

    .quick-sticker-row {
      gap: 6px;
    }

    .emoji-sticker-btn {
      width: 64px;
      height: 64px;
      min-height: 64px;
      font-size: 34px;
    }

    .emoji-sticker-btn:hover {
      transform: scale(1.05);
    }


    .container {
      max-width: none;
      padding: 10px;
    }

    .preview-layout {
      display: block;
    }

    .canvas-wrap {
      margin-bottom: 10px;
    }

    .object-selector {
      margin-top: 10px;
      margin-bottom: 12px;
      overflow: hidden;
      position: relative;
      cursor: pointer;
    }

    .object-selector::after {
      content: "更多編輯 ▾";
      display: block;
      margin-top: 8px;
      padding: 12px 12px;
      text-align: center;
      font-size: 24px;
      font-weight: bold;
      color: #0b6bcb;
      background: #eef6ff;
      border-radius: 8px;
      white-space: normal;
    }

    .object-selector.mobile-open {
      max-height: none;
      overflow: visible;
    }

    .object-selector.mobile-open::after {
      content: "收合編輯 ▴";
    }

    .object-selector-title {
      font-size: 28px !important;
      text-align: center;
      font-weight: bold;
      margin-bottom: 6px;
    }

    .active-object-text {
      text-align: center;
      font-size: 16px;
      font-weight: bold;
      color: #0b6bcb;
      margin-bottom: 8px;
    }

    .object-btn {
      flex: 0 0 auto;
      width: 92px;
      min-width: 92px;
      margin-bottom: 0;
      min-height: 72px !important;
      font-size: 24px !important;
    }

    .object-layer-box,
    .object-usage-info,
    .object-divider {
      display: none;
    }

    .object-control-box {
      display: block;
      margin-top: 8px;
      padding-top: 8px;
      border-top: none;
    }

    .object-selector.mobile-open .object-layer-box,
    .object-selector.mobile-open .object-usage-info,
    .object-selector.mobile-open .object-divider {
      display: block;
    }

    .object-control-box label,
    .object-control-box input[type="range"],
    .object-control-box .object-button-row {
      display: none;
    }

    .object-selector.mobile-open #deleteObjectBtn,
    .object-selector.mobile-open #resetBtn {
      display: block;
    }

    .object-selector.mobile-open .object-control-box .single-button-row {
      display: flex;
    }

    .object-control-label {
      font-size: 16px;
    }

    h1 {
      font-size: 32px;
    }

    .hint {
      font-size: 26px !important;
      line-height: 1.6;
    }

    label {
      font-size: 22px;
      margin-bottom: 10px;
    }

    input[type="text"],
    textarea,
    select {
      font-size: 24px !important;
      padding: 14px !important;
      min-height: 60px !important;
      line-height: 1.4 !important;
    }

    button {
      min-height: 60px;
      font-size: 20px;
      font-weight: bold;
    }

    .submit-btn {
      font-size: 24px;
      min-height: 70px;
    }

    .category-tab {
      font-size: 18px;
      padding: 12px 18px;
    }

    #frameSelect,
    #textStyleSelect {
      font-size: 18px !important;
      min-height: 54px !important;
    }

    .file-button {
      font-size: 20px;
      min-height: 54px;
      padding: 13px 10px;
    }

    .file-name-text {
      font-size: 14px;
    }

    .top-control-row {
      grid-template-columns: 1fr 1.3fr;
      gap: 10px;
    }

    .compact-card {
      flex-direction: column;
    }

    .card-left {
      width: 100%;
    }

    .card-right {
      display: block;
    }

    .status-tabs {
      grid-template-columns: repeat(2, 1fr);
    }

    .search-box {
      flex-direction: column;
    }

    .search-box button {
      width: 100%;
    }

    .object-selector {
      margin-top: 10px;
      margin-bottom: 12px;
      overflow: hidden;
      position: relative;
      cursor: pointer;
    }

    .object-selector .object-btn {
      display: inline-flex;
      justify-content: center;
      align-items: center;
      vertical-align: top;
    }

    .object-selector button {
      min-height: 72px !important;
      font-size: 24px !important;
    }

    .object-selector {
      white-space: nowrap;
      overflow-x: auto;
      padding-bottom: 10px;
    }

    .object-list-row {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: nowrap;
      overflow-x: auto;
      padding-bottom: 4px;
    }

    .object-list-row .object-btn {
      flex: 0 0 auto;
      width: 92px;
      min-width: 92px;
      margin-bottom: 0;
    }

    .object-list-separator {
      flex: 0 0 auto;
      width: 1px;
      height: 34px;
      background: #ccc;
      border-top: none;
      margin: 0 4px;
    }

    /* 手機版有感放大 */

    body {
      font-size: 22px !important;
    }

    h1 {
      font-size: 40px !important;
    }

    .hint {
      font-size: 22px !important;
      line-height: 1.6;
    }

    label {
      font-size: 28px !important;
    }

    button {
      font-size: 26px !important;
      min-height: 76px !important;
    }

    input[type="text"],
    textarea,
    select {
      font-size: 28px !important;
      min-height: 76px !important;
    }

    .accordion-btn {
      font-size: 28px !important;
      min-height: 80px !important;
    }

    .category-tab,
    .sticker-category-btn {
      font-size: 24px !important;
      padding: 16px 22px !important;
    }

    .frame-card-name,
    .png-sticker-name {
      font-size: 22px !important;
    }

    .mobile-edit-mode-btn {
      width: 180px !important;
      height: 88px !important;
      font-size: 28px !important;
    }

    .object-usage-info {
      font-size: 24px !important;
      font-weight: bold;
    }

    #objectCountText {
      font-size: 24px !important;
      font-weight: bold;
    }

    .object-control-label {
      font-size: 28px !important;
      font-weight: bold;
      margin-bottom: 10px;
    }

    .object-button-row button {
      min-height: 80px !important;
      font-size: 32px !important;
      font-weight: bold;
      border-radius: 12px;
    }

    .edit-mode-hint {
      font-size: 24px !important;
      color: #666;
      text-align: center;
      margin-bottom: 10px;
      line-height: 1.5;
    }

    .photo-button-row {
      display: flex;
      gap: 8px;
      margin-bottom: 10px;
    }

    .photo-button-row .file-button {
      flex: 1;
      text-align: center;
      padding: 14px 8px;
      font-size: 18px;
    }

    .single-button-row button,
    .object-button-row button,
    #resetBtn {

      min-height: 80px !important;

      font-size: 28px !important;

      font-weight: bold;

    }
  }