/* 基本スタイル */
      body {
        margin: 0;
        padding: 0.8em;
        background: #eef;
        font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Yu Gothic", "YuGothic", Verdana, Meiryo, sans-serif;
        text-align: center;
        font-size: 15px;
        color: #333;
        line-height: 1.6;
      }

      /* ▼▼▼ スマホ入力時のズーム防止 ▼▼▼ */
      input, select, textarea {
        font-size: 16px !important;
      }

      .calculator-wrapper {
        max-width: 480px;
        margin: 0 auto;
      }

      /* 上部バーのスタイル */
      .top-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: 0.8em auto;
      }

      /* ヘッダーリンク用スタイル */
      .header-links {
        font-size: 0.8em;
      }
      .header-links a {
        color: #555;
        text-decoration: none;
        margin-left: 0.5em;
      }
      .header-links a:hover {
        text-decoration: underline;
      }
      .header-links a + a::before {
        content: "|";
        margin-right: 0.5em;
        color: #555;
      }

      h1 {
        color: #333;
        font-size: 1.6em;
        margin-bottom: 0.6em;
        font-weight: bold;
      }

      .site-description {
        font-size: 0.95em;
        color: #555;
        margin: 0.5em auto 1.2em auto;
        max-width: 500px;
        line-height: 1.6;
        text-align: center;
      }

      h2 {
        color: #333;
        font-size: 1.3em;
        margin-bottom: 0.8em;
        border-bottom: 2px solid #eee;
        padding-bottom: 0.3em;
        font-weight: bold;
      }

      .section {
        background: #fff;
        border-radius: 10px;
        padding: 1.2em;
        margin: 0.8em auto;
        box-shadow: 0 3px 12px rgba(0,0,0,0.08);
        position: relative;
        text-align: left;
      }

      label {
        display: block;
        margin-bottom: 1em;
        color: #555;
        font-weight: bold;
        font-size: 0.95em;
      }
      .label-with-tooltip {
        display: flex;
        align-items: center;
        justify-content: space-between;
      }

      select,
      input[type="number"] {
        font-size: 1em;
        padding: 0.8em;
        width: 100%;
        margin: 0.4em auto 0 auto;
        display: block;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-sizing: border-box;
        background: #fafafa;
      }
      input:focus, select:focus {
        border-color: #007bff;
        background: #fff;
        outline: none;
      }

      input[type="number"] {
        -moz-appearance: textfield;
      }
      input[type="number"]::-webkit-outer-spin-button,
      input[type="number"]::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
      }

      button {
        font-size: 1.05em;
        padding: 0.8em 1.5em;
        background: #28a745;
        color: white;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        margin-top: 1em;
        transition: background-color 0.2s ease;
        box-shadow: 0 2px 0 #1e7e34;
      }
      button:hover:not(:disabled) {
        background-color: #218838;
      }
      button:active {
        transform: translateY(2px);
        box-shadow: none;
      }
      button:disabled {
        background-color: #aaa;
        cursor: not-allowed;
        box-shadow: none;
      }

      .result {
        font-weight: bold;
        margin: 1em 0 0.8em;
        font-size: 1.1em;
        line-height: 1.6;
      }
      .result.has-result {
        padding: 0.8em;
        background-color: #f8f9fa;
        border-left: 4px solid #28a745;
        border-radius: 4px;
        text-align: left;
      }

      /* ▼▼▼ 追加：Amazon誘導ボタン ▼▼▼ */
      .amazon-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        max-width: 100%;
        margin-top: 1.2em;
        padding: 1em 0.5em;
        background: linear-gradient(to bottom, #f7dfa5, #f0c14b);
        border: 1px solid #a88734;
        border-radius: 4px;
        color: #111;
        font-weight: bold;
        text-decoration: none;
        box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset, 0 1px 2px rgba(0,0,0,0.2);
        transition: all 0.2s;
        box-sizing: border-box;
      }
      .amazon-btn:hover {
        background: linear-gradient(to bottom, #f5d78e, #eeb933);
        cursor: pointer;
      }
      .amazon-btn .icon {
        font-size: 1.2em;
        margin-right: 0.5em;
      }
      .amazon-note {
        font-size: 0.75em;
        color: #888;
        text-align: right;
        margin-top: 0.3em;
        display: block;
      }
      /* ▲▲▲ 追加ここまで ▲▲▲ */

      .result b {
        color: #007bff;
      }
      .result dl { margin: 0; }
      .result dt { font-weight: normal; color: #555; font-size: 0.9em; }
      .result dd { margin-left: 0; margin-bottom: 0.5em; }
      .rate-info { font-size: 0.8em; color: #666; }
      .error-text { color: #dc3545; }

      .tab-switch {
        margin-top: 0.8em;
        margin-bottom: 1em;
        text-align: center;
      }
      .tab-switch button {
        background: #6c757d;
        margin: 0 0.2em;
        font-size: 0.95em;
        padding: 0.5em 1em;
        font-weight: normal;
        box-shadow: none;
      }
      .tab-switch button:hover:not(.active) {
        background-color: #5a6268;
      }
      .tab-switch button.active {
        background: #28a745;
        font-weight: bold;
      }

      .info-btn {
        background: #aaa;
        color: white;
        border-radius: 50%;
        width: 1.5em;
        height: 1.5em;
        line-height: 1.5em;
        font-size: 0.8em;
        font-weight: bold;
        text-align: center;
        display: inline-block;
        cursor: pointer;
        margin-left: 0.4em;
        position: relative;
        vertical-align: middle;
        user-select: none;
        border: 2px solid transparent;
        flex-shrink: 0;
      }
      .info-btn:focus {
        outline: none;
        border-color: #007bff;
        box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
      }

      .tooltip-box {
        display: none;
        position: absolute;
        background: rgba(51, 51, 51, 0.95);
        color: white;
        padding: 0.9em;
        border-radius: 8px;
        font-size: 0.9em;
        white-space: normal;
        width: 280px;
        top: 2.5em;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1000;
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
        text-align: left;
        font-weight: normal;
      }
      .tooltip-box.visible {
        display: block;
      }
      .tooltip-box strong, .tooltip-box b { font-weight: bold; }
      .tooltip-box ol, .tooltip-box ul { padding-left: 20px; margin: 0.5em 0; }
      .tooltip-box hr { border: 0; border-top: 1px solid #666; margin: 0.5em 0; }
      .tooltip-box p { margin: 0.5em 0; }

      .warning {
        color: #dc3545;
        font-size: 0.85em;
        margin-top: 0.8em;
        padding: 0.6em;
        background-color: #f8d7da;
        border: 1px solid #f5c6cb;
        border-radius: 4px;
        line-height: 1.4;
      }

      #copyButton {
        background: #007bff;
        font-size: 0.9em;
        margin-left: 0.5em;
        box-shadow: none;
      }
      #copyButton:hover {
        background-color: #0056b3;
      }

      #tweetButton, #share-twitter-reverse {
        background: #000; /* Xロゴ色に変更 */
        font-size: 0.9em;
        padding: 0.8em 1.2em;
        margin-top: 0.8em;
        margin-left: 0.5em;
        box-shadow: none;
        border-radius: 20px;
      }
      #tweetButton:hover, #share-twitter-reverse:hover {
        opacity: 0.8;
      }

      .hidden {
        display: none !important;
      }

      .page-footer {
        margin-top: 2em;
        padding-top: 1em;
        border-top: 1px solid #ddd;
        text-align: center;
        font-size: 0.85em;
        color: #666;
        padding-bottom: 2em;
      }
      .page-footer p {
        margin-bottom: 0.5em;
      }
      .page-footer a {
        color: #666;
        text-decoration: none;
        margin: 0 0.5em;
        border-bottom: 1px dotted #999;
      }
      .page-footer a:hover {
        color: #007bff;
        border-bottom: 1px solid #007bff;
      }
      .copyright {
        margin-top: 0.8em;
        font-size: 0.8em;
        color: #aaa;
      }

      /* 言語切替ボタンのスタイル */
      .region-switch {
        display: inline-flex;
        margin: 0;
        gap: 0;
      }
      .region-switch button {
        padding: .4em 1em;
        background: #fff;
        color: #6c757d;
        border: 1px solid #dee2e6;
        border-radius: 0;
        cursor: pointer;
        font-size: .85em;
        font-weight: normal;
        margin-top: 0;
        box-shadow: none;
      }
      .region-switch button:first-child {
        border-top-left-radius: 6px;
        border-bottom-left-radius: 6px;
        border-right: none;
      }
      .region-switch button:last-child {
        border-top-right-radius: 6px;
        border-bottom-right-radius: 6px;
      }
      .region-switch button.active {
        background: #007bff;
        color: #fff;
        border-color: #007bff;
        font-weight: bold;
      }
      
      /* 日記モードのデザイン */
      .diary-header { 
        display: flex; 
        justify-content: center; 
        align-items: center; 
        gap: 1em; 
        margin: 1.5em 0; 
      }
      .diary-header h2 { 
        margin: 0; 
        font-size: 1.8em; 
        color: #333;
        border-bottom: none;
      }
      .diary-header button { 
        font-size: 1.5em; 
        font-weight: 700;
        background: none; 
        border: none; 
        color: #007bff;
        padding: .2em .6em; 
        border-radius: 50%;
        margin-top: 0;
        transition: .2s;
        box-shadow: none;
      }
      .diary-header button:hover { 
        background: #007bff; 
        color: #fff;
      }

      .month-selector { 
        display: grid; 
        grid-template-columns: repeat(3, 1fr); 
        gap: 10px; 
        margin: 2em 0; 
      }
      .month-selector button { 
        background: #fff; 
        border: 1px solid #ddd; 
        padding: .8em 0; 
        color: #555; 
        cursor: pointer; 
        margin-top: 0;
        border-radius: 8px;
        transition: transform .2s, box-shadow .2s;
        box-shadow: none;
      }
      .month-selector button:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
      }
      .month-selector button.active { 
        background: #28a745; 
        color: #fff; 
        font-weight: 700; 
        border-color: #28a745;
        transform: none;
        box-shadow: none;
      }

      .diary-input-area {
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 10px;
        padding: 1.5em;
        margin-bottom: 2em;
      }
      .diary-input-area h3 { 
        font-size: 1.5em; 
        margin: 0 0 1.2em; 
        color: #333;
        text-align: center;
      }
      .week-inputs {
        display: flex;
        flex-direction: column;
        gap: 1em;
      }
      .week-row { 
        display: grid; 
        grid-template-columns: 1fr 100px 120px auto; 
        gap: 12px; 
        align-items: center; 
        padding-bottom: 1em;
        border-bottom: 1px solid #f0f0f0;
      }
      .week-row:last-child {
        border-bottom: none;
        padding-bottom: 0;
      }
      .week-row label { 
        margin-bottom: 0; 
        font-weight: normal;
        text-align: left;
      }
      .week-row input, .week-row select, .week-row button { 
        margin-top: 0; 
      }
      .week-row button {
        padding: 0.5em 1em;
        font-size: 0.9em;
        box-shadow: none;
      }

      .diary-summary { 
        display: grid; 
        grid-template-columns: 1fr 1fr; 
        gap: 1.5em; 
        margin: 2em 0; 
      }
      .summary-box { 
        background: #fff; 
        border: 1px solid #e8e8e8;
        padding: 1.5em; 
        border-radius: 12px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.05);
        text-align: left; 
      }
      .summary-box h4 { 
        margin: 0 0 1em; 
        font-size: 1.2em; 
        color: #333;
        border-bottom: 2px solid #28a745;
        padding-bottom: .5em;
      }
      .summary-box dl { 
        margin: 0; 
        display: grid; 
        grid-template-columns: auto 1fr; 
        gap: 0.5em 1em; 
        align-items: center;
      }
      .summary-box dt { 
        font-weight: normal; 
        color: #555;
      }
      .summary-box dd { 
        margin: 0; 
        font-weight: bold; 
        font-size: 1.4em;
        color: #007bff;
      }
      .guest-notice { 
        font-size: .9em; 
        color: #555; 
        background: #fffbe6; 
        border: 1px solid #ffecb3; 
        padding: 1em; 
        border-radius: 8px; 
        line-height: 1.6; 
      }

      @media(max-width:480px){
        .week-row { 
          grid-template-columns: 1fr 1fr;
          grid-template-areas: 
            "label label"
            "points prize"
            "save save";
          gap: .8em; 
        }
        .week-row label { grid-area: label; text-align: center; margin-bottom: 0.5em; }
        .week-row input { grid-area: points; }
        .week-row select { grid-area: prize; }
        .week-row button { grid-area: save; width: 100%; }
        .diary-summary { grid-template-columns: 1fr; }
      }