<style>
    :root {
      --pink: #F6C1CC;
      --brown: #6B4F3F;
      --yellow: #F4D06F;
      --cream: #FFF7ED;
      --card: #FFFFFF;
      --line: #EAD7CB;
      --shadow: rgba(107, 79, 63, 0.18);
    }

    * { box-sizing: border-box; font-family: 'Nunito', sans-serif; }

    body {
        margin: 0;
        min-height: 100vh;
        background: linear-gradient(180deg, #FBE4E9, #FFF7ED);
        display: flex;
        justify-content: center;
        align-items: flex-start;   /* ✅ 改这里 */
        padding: 18px;
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
    }

    /* ===== Outer shell becomes responsive ===== */
    .shell {
      width: 100%;
      max-width: 980px; /* desktop can be wider now */
    }

    .app {
      width: 100%;
      background: var(--card);
      border-radius: 26px;
      padding: 22px;
      box-shadow: 0 18px 40px var(--shadow);
      position: relative;
      overflow: hidden;
    }

    /* ===== Language Toggle ===== */
    .lang-toggle {
      position: absolute;
      top: 14px;
      right: 16px;
      background: #FFF;
      border: 2px solid var(--line);
      border-radius: 999px;
      overflow: hidden;
      display: flex;
      font-size: 12px;
      user-select: none;
      z-index: 5;
    }
    .lang-toggle span {
      padding: 6px 10px;
      cursor: pointer;
      color: var(--brown);
    }
    .lang-toggle .active {
      background: var(--yellow);
      font-weight: 700;
    }

    .header { text-align: center; margin-top: 12px; margin-bottom: 10px; }
    .header h1 { margin: 0; font-size: 28px; color: var(--brown); letter-spacing: -0.3px; }
    .header p { margin-top: 6px; font-size: 14px; color: #8A6E5A; }

    /* Enter contents*/
    .pill {
      margin: 14px auto 0;
      width: fit-content;
      background: #FFF8DC;
      border: 1px dashed #E4C9A8;
      color: #6B4F3F;
      border-radius: 999px;
      padding: 6px 10px;
      font-size: 12px;
    }

    /* ===== Main layout: mobile 1-col, desktop 2-col ===== */
    .layout {
      margin-top: 16px;
      display: grid;
      grid-template-columns: 1fr;
      gap: 14px;
    }

    /* Buttons*/
    .panel {
      background: rgba(255, 247, 237, 0.35);
      border: 1px solid rgba(234, 215, 203, 0.8);
      border-radius: 20px;
      padding: 14px;
    }

    .section { margin-top: 14px; }
    .section:first-child { margin-top: 0; }

    label {
      display: block;
      font-weight: 700;
      margin-bottom: 6px;
      color: var(--brown);
    }

    textarea, select, input {
      width: 100%;
      border-radius: 16px;
      padding: 11px 12px;
      border: 2px solid var(--line);
      background: var(--cream);
      font-size: 14px;
      color: #4A372D;
      outline: none;
    }

    textarea { resize: none; }

    textarea:focus, select:focus, input:focus {
      border-color: var(--pink);
      background: #FFF;
    }

    .grid-2 {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }

    .hint {
      margin-top: 6px;
      font-size: 12px;
      color: #9C7C6A;
    }

    .notice {
      margin-top: 8px;
      padding: 10px 12px;
      border-radius: 12px;
      font-size: 12px;
      line-height: 1.4;
    }

    .notice.warning {
      background: #FFF2D9;
      border: 1px solid #F4D06F;
      color: #6B4F3F;
    }

    .button-wrapper { margin-top: 16px; text-align: center; }

    button {
      width: 100%;
      max-width: 360px;
      background: var(--yellow);
      color: var(--brown);
      border: none;
      border-radius: 999px;
      padding: 13px 22px;
      font-size: 15px;
      font-weight: 800;
      cursor: pointer;
      box-shadow: 0 10px 22px rgba(244, 208, 111, 0.55);
      transition: transform 0.15s ease, box-shadow 0.15s ease;
    }
    button:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(244, 208, 111, 0.65); }
    button:active { transform: translateY(0px); }

    /* ===== Reaction panel ===== */
    .reaction-wrap {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .reaction-title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .reaction-title h3 {
      margin: 0;
      font-size: 14px;
      color: var(--brown);
      font-weight: 800;
      letter-spacing: -0.2px;
    }

    .mini-btns {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .mini-btn {
      border: 1px solid var(--line);
      background: #fff;
      color: var(--brown);
      padding: 6px 10px;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
    }
    .mini-btn:hover { filter: brightness(0.98); }

    .reaction {
      background: #FFF8DC;
      border-radius: 18px;
      padding: 14px 16px;
      min-height: 140px;
      font-size: 14px;
      line-height: 1.65;
      white-space: pre-wrap;
      color: #5A4033;
      border: 1px solid rgba(228, 201, 168, 0.8);
    }
    .reaction.loading { opacity: 0.75; font-style: italic; }

    .footer-note {
      margin-top: 10px;
      font-size: 11px;
      color: #A18673;
      text-align: center;
    }

    /* ===== Desktop enhancements ===== */
    @media (min-width: 860px) {
      body { padding: 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
      .app { padding: 26px; }
      .header h1 { font-size: 32px; }
      .layout {
        grid-template-columns: 1.05fr 0.95fr; /* left: inputs, right: result */
        gap: 18px;
        align-items: start;
      }
      .panel { padding: 18px; border-radius: 22px; }

      /* Sticky result on desktop for nice UX */
      .right-panel {
        position: sticky;
        top: 18px;
      }

      /* Make reaction scroll inside the right panel */
      .reaction {
        min-height: 520px;
        max-height: 62vh;
        overflow: auto;
      }
    }

    /* ===== Small phones ===== */
    @media (max-width: 380px) {
      .grid-2 { grid-template-columns: 1fr; }
      .lang-toggle { top: 10px; right: 10px; }
      .header h1 { font-size: 26px; }
    }


    /* ===== Items table ===== */
    .items-toolbar {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 10px;
    }

    .items-table {
      border: 1px solid rgba(234, 215, 203, 0.8);
      border-radius: 16px;
      background: rgba(255, 247, 237, 0.35);
      padding: 10px;
    }

    #items-rows {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .item-row {
      border: 1px solid rgba(234, 215, 203, 0.9);
      border-radius: 14px;
      background: #fff;
      padding: 10px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .item-field-line {
      display: grid;
      grid-template-columns: 150px 1fr;
      gap: 10px;
      align-items: center;
    }

    .item-field-label {
      font-size: 12px;
      font-weight: 800;
      color: var(--brown);
      white-space: nowrap;
    }

    .item-row input {
      padding: 9px 10px;
      border-radius: 12px;
      font-size: 13px;
    }

    .item-photo-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .item-photo-actions .mini-btn {
      width: auto;
      max-width: none;
    }

    .item-photo-status {
      margin-left: 160px;
    }

    .remove-btn {
      width: 40px;
      height: 34px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: #fff;
      cursor: pointer;
      font-weight: 900;
      color: var(--brown);
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .remove-btn:hover { filter: brightness(0.98); }

    .inv-preview-row {
      background: #fff;
      border: 1px solid rgba(234, 215, 203, 0.9);
      border-radius: 14px;
      padding: 10px;
      margin-bottom: 10px;
    }

    .inv-preview-head {
      font-size: 14px;
      font-weight: 800;
      color: var(--brown);
      margin-bottom: 8px;
    }

    .inv-preview-details {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .inv-detail-line {
      display: grid;
      grid-template-columns: 130px 1fr;
      gap: 8px;
      font-size: 12px;
      color: #6d5142;
    }

    .inv-detail-key {
      font-weight: 700;
      color: var(--brown);
    }

    .inv-entry-actions {
      margin-top: 10px;
      display: flex;
      gap: 8px;
    }

    .split-btn {
      flex: 1;
      max-width: none;
    }

    .inv-inline-edit {
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px dashed var(--line);
    }

    .inv-inline-edit .item-field-line {
      grid-template-columns: 130px 1fr;
    }

    .inv-inline-edit .edit-hint {
      min-height: 16px;
    }

    /* small screens: stack fields */
    @media (max-width: 720px) {
      .item-field-line,
      .inv-detail-line,
      .inv-inline-edit .item-field-line {
        grid-template-columns: 120px 1fr;
        gap: 6px;
      }

      .item-photo-status {
        margin-left: 0;
      }
    }

    .hidden { display: none !important; }

    
    .reminder-list {
      margin-top: 20px;
    }
    
    .reminder-item {
      background: #fff5e6;
      padding: 10px;
      margin-bottom: 8px;
      border-radius: 8px;
    }
    
    .home-reminder-banner {
      background: #ffe0e0;
      padding: 15px;
      border-radius: 12px;
      margin-bottom: 20px;
    }
    
    .home-reminder-line {
      margin-bottom: 5px;
    }

</style>
