* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

.header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 20px;
}

h1 {
    color: #333;
    text-align: center;
    margin: 0;
}

.btn-theme {
    position: absolute;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn-theme:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.card h2 {
    color: #333;
    margin-bottom: 16px;
    font-size: 1.2rem;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.card-header h2 {
    margin-bottom: 0;
}

.btn-toggle {
    flex: none;
    padding: 0;
    font-size: 1.2rem;
    background: transparent;
    color: #999;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.btn-toggle:hover {
    color: #333;
}

.history-list.hidden {
    display: none;
}

.history-buttons.hidden {
    display: none;
}

.password-display {
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 1.3rem;
    text-align: center;
    word-break: break-all;
    margin-bottom: 16px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.strength-meter {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-bar.weak {
    background: #ff5252;
    width: 25%;
}

.strength-bar.fair {
    background: #ffa726;
    width: 50%;
}

.strength-bar.good {
    background: #66bb6a;
    width: 75%;
}

.strength-bar.strong {
    background: #26a69a;
    width: 100%;
}

.strength-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.strength-label {
    font-weight: bold;
}

.strength-label.weak {
    color: #ff5252;
}

.strength-label.fair {
    color: #ffa726;
}

.strength-label.good {
    color: #66bb6a;
}

.strength-label.strong {
    color: #26a69a;
}

.strength-details {
    color: #888;
    font-size: 0.8rem;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #4a90d9;
    color: white;
}

.btn-primary:hover {
    background: #3a7fc8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.3);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-danger {
    background: #ff5252;
    color: white;
}

.btn-danger:hover {
    background: #ff1744;
}

.options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.option label {
    cursor: pointer;
    color: #555;
}

.length-control {
    margin-bottom: 20px;
}

.length-control label {
    display: block;
    margin-bottom: 8px;
    color: #555;
}

.length-control input[type="range"] {
    width: 100%;
    margin-bottom: 8px;
}

.length-value {
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #4a90d9;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    position: relative;
}

.history-item:hover {
    background: #f0f0f0;
}

.history-password {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    word-break: break-all;
    margin-bottom: 8px;
    padding-right: 30px;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #888;
}

.history-memo {
    flex: 1;
    margin-right: 10px;
}

.history-memo input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.history-actions {
    display: flex;
    gap: 6px;
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
}

.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #ff5252;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

.delete-btn:hover {
    color: #ff1744;
}

.empty-history {
    text-align: center;
    color: #888;
    padding: 40px;
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
}

.storage-info {
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    margin-top: 10px;
}

.history-timestamp {
    font-size: 0.75rem;
    color: #aaa;
    margin-top: 4px;
}

.history-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.history-buttons .btn {
    flex: 1;
    padding: 10px;
    font-size: 0.9rem;
}

/* ダークモード */
body.dark-mode {
    background: #1a1a2e;
}

body.dark-mode h1 {
    color: #e0e0e0;
}

body.dark-mode .card {
    background: #16213e;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

body.dark-mode .card h2 {
    color: #e0e0e0;
}

body.dark-mode .password-display {
    background: #0f3460;
    border-color: #1a1a2e;
    color: #e0e0e0;
}

body.dark-mode .strength-meter {
    background: #0f3460;
}

body.dark-mode .btn-primary {
    background: #3d7cc9;
}

body.dark-mode .btn-primary:hover {
    background: #5a9ae0;
    box-shadow: 0 4px 12px rgba(61, 124, 201, 0.4);
}

body.dark-mode .btn-secondary {
    background: #0f3460;
    color: #e0e0e0;
}

body.dark-mode .btn-secondary:hover {
    background: #1a4a7a;
}

body.dark-mode .option label {
    color: #b0b0b0;
}

body.dark-mode .length-control label {
    color: #b0b0b0;
}

body.dark-mode .history-item {
    background: #0f3460;
    border-color: #1a1a2e;
}

body.dark-mode .history-item:hover {
    background: #1a4a7a;
}

body.dark-mode .history-password {
    color: #e0e0e0;
}

body.dark-mode .history-memo input {
    background: #16213e;
    border-color: #0f3460;
    color: #e0e0e0;
}

body.dark-mode .history-memo input::placeholder {
    color: #888;
}

body.dark-mode .btn-toggle {
    color: #888;
}

body.dark-mode .btn-toggle:hover {
    color: #e0e0e0;
}

body.dark-mode .btn-theme {
    background: #16213e;
    border-color: #0f3460;
    color: #e0e0e0;
}

body.dark-mode .btn-theme:hover {
    background: #0f3460;
}

/* 言語切替ボタン */
.lang-switcher {
    position: absolute;
    left: 0;
    display: flex;
    gap: 4px;
}

.lang-btn {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #888;
}

.lang-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.lang-btn.active {
    background: #4a90d9;
    color: white;
    border-color: #4a90d9;
}

body.dark-mode .lang-btn {
    background: #16213e;
    border-color: #0f3460;
    color: #888;
}

body.dark-mode .lang-btn:hover {
    background: #0f3460;
    color: #e0e0e0;
}

body.dark-mode .lang-btn.active {
    background: #3d7cc9;
    border-color: #3d7cc9;
    color: white;
}

body.dark-mode .storage-info {
    color: #888;
}

body.dark-mode .empty-history {
    color: #888;
}

body.dark-mode .toast {
    background: #e0e0e0;
    color: #1a1a2e;
}
