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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    min-height: 100vh;
    padding: 0;
}

.page-container {
    max-width: 2000px;
    margin: 0 auto;
    padding: 20px;
}

.header-container {
    position: relative;
    background: #2c2c2c;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.page-title {
    text-align: center;
    color: white;
    font-size: 2.5rem;
    margin: 0;
    font-weight: 300;
    line-height: 1.2;
}

.page-title .subtitle {
    display: block;
    font-size: 1.2rem;
    font-weight: 300;
    margin-top: 8px;
    opacity: 0.9;
}

.settings-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    color: black;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: #f0f0f0;
    transform: translateY(-50%) scale(1.1);
}

.help-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    color: black;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-btn:hover {
    background: #777777;
    transform: translateY(-50%) scale(1.1);
}

/* ヘルプポップアップ */
.help-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.help-popup.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-content {
    background: white;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 15px 25px;
    border-bottom: 1px solid #eee;
}

.help-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
}

.close-btn {
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: #e0e0e0;
}

.help-body {
    padding: 20px 25px 25px 25px;
}

.help-body h3 {
    color: #333;
    margin: 20px 0 10px 0;
    font-size: 1.2rem;
}

.help-body h3:first-child {
    margin-top: 0;
}

.help-body ul {
    margin: 0;
    padding-left: 20px;
}

.help-body li {
    margin: 8px 0;
    color: #555;
    line-height: 1.5;
}

.action-buttons {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.reset-all-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.reset-all-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.reset-all-btn:active {
    transform: translateY(0);
}

/* 設定ポップアップ */
.settings-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.settings-popup.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-content {
    background: white;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 15px 25px;
    border-bottom: 1px solid #eee;
}

.settings-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
}

.settings-body {
    padding: 20px 25px 25px 25px;
}

.settings-body h3 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 1.2rem;
}

.settings-body p {
    color: #666;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.clear-all-btn {
    background: #ffc107;
    color: #333;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.clear-all-btn:hover {
    background: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.clear-all-btn:active {
    transform: translateY(0);
}

/* 言語切り替えセクション */
.language-section {
    margin-top: 30px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.language-section h3 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 1.2rem;
}

.language-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.language-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-height: 70px;
    justify-content: center;
    text-decoration: none;
    color: inherit;
}

.language-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.language-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.language-btn.active:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.language-btn .flag {
    font-size: 1.5rem;
    line-height: 1;
}

.language-btn .lang-name {
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}

.calculators-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    justify-items: center;
    align-items: start;
    padding: 20px 0;
    margin: 0 auto;
    /* GPUアクセラレーション有効化 */
    transform: translateZ(0);
}

.calculator-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.1);
    text-align: center;
    /* GPUアクセラレーション有効化 */
    transform: translateZ(0);
    will-change: transform;
}

.calculator-title {
    color: #333;
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.1);
}

.calculator-title:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 140, 66, 0.3);
}

.calculator-title:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.3);
    border-color: #ff8c42;
    box-shadow: 0 0 0 3px rgba(255, 140, 66, 0.2);
}

.calculator-title i {
    color: #ff8c42;
    margin-right: 8px;
    font-size: 1rem;
    pointer-events: none;
}

.calculator-title .editable-text {
    display: inline-block;
    min-width: 1em;
    outline: none;
}

.calculator-title .editable-text:empty::before {
    content: 'タイトルを入力';
    color: #999;
    font-style: italic;
}

.title-container {
    position: relative;
    margin-bottom: 15px;
    text-align: left;
}

.calculator-title-input {
    width: calc(100% - 40px);
    padding: 8px 12px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #333;
    font-size: 1.2rem;
    font-weight: 500;
    transition: all 0.2s ease;
    outline: none;
    margin-left: 40px;
}

.calculator-title-input:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 140, 66, 0.3);
}

.calculator-title-input:focus {
    background: rgba(255, 255, 255, 0.3);
    border-color: #ff8c42;
    box-shadow: 0 0 0 3px rgba(255, 140, 66, 0.2);
}

.title-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #ff8c42;
    font-size: 1rem;
    pointer-events: none;
}

.calculator {
    width: 400px;
    height: 400px;
    background: #2c2c2c;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.display {
    background: #3a3a3a;
    padding: 20px;
    text-align: right;
    height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.previous-operand {
    color: #b0b0b0;
    font-size: 16px;
    margin-bottom: 8px;
    min-height: 20px;
}

.current-operand {
    color: #fff;
    font-size: 36px;
    font-weight: 300;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 12px;
}

.clipboard-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.clipboard-btn {
    background: #666666 !important;
    color: #fff;
    font-size: 15px !important;
    padding: 10px 12px !important;
    border-radius: 6px;
    width: 90px !important;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clipboard-btn:hover {
    background: #777777 !important;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    background: #404040;
    padding: 12px;
    height: 240px;
}

.btn {
    border: none;
    outline: none;
    background: #555555;
    color: #fff;
    font-size: 18px;
    font-weight: 500;
    padding: 15px 0;
    cursor: pointer;
    transition: background-color 0.15s ease;
    position: relative;
    overflow: hidden;
}



.btn:hover {
    background: #666666;
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.btn.operator {
    background: #888888;
    color: #fff;
}

.btn.operator:hover {
    background: #999999;
}

.btn.clear {
    background: #666666;
    color: #fff;
}

.btn.clear:hover {
    background: #777777;
}

.btn.equals {
    background: #ff8c42;
    color: #fff;
    grid-row: span 2;
}

.btn.equals:hover {
    background: #ff9f5a;
    box-shadow: 0 5px 15px rgba(255, 140, 66, 0.4);
}

.btn.zero {
    grid-column: span 2;
}

/* レスポンシブデザイン */
@media (max-width: 1900px) {
    .calculators-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
        max-width: 900px;
        margin: 0 auto;
    }
}

@media (max-width: 1000px) {
    .page-title {
        font-size: 1.5rem;
    }
    .page-title .subtitle {
        display: none;
    }

    .calculators-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .calculator {
        width: 350px;
        height: 350px;
    }
    
    .display {
        height: 140px;
        padding: 15px;
    }
    
    .buttons {
        height: 210px;
        padding: 8px;
    }
    
    .current-operand {
        font-size: 28px;
    }
    
    .btn {
        padding: 14px 0;
        font-size: 16px;
    }
}

/* フッター */
.footer {
    background: #2c2c2c;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

.footer a {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    transition: opacity 0.3s ease;
}

.footer a:hover {
    opacity: 0.8;
}

 