/* グローバルスタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #34d399;
    --secondary-color: #059669;
    --success-color: #34d399;
    --accent-orange: #fb923c;
    --accent-yellow: #fbbf24;
    --accent-blue: #60a5fa;
    --danger-color: #ef4444;
    --light-bg: #f0fdf4;
    --white: #ffffff;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --border-color: #d1fae5;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    background: #fef6e4;
    min-height: 100vh;
    padding: 20px;
    -webkit-tap-highlight-color: transparent;
}

/* 小さいフォントサイズ用のゴシック体設定（読みやすさ重視） */
.small-text,
button,
.btn,
input,
select,
textarea,
label,
.form-label,
.tab-button,
.info-label {
    font-family: 'Noto Sans JP', 'M PLUS Rounded 1c', sans-serif;
    touch-action: manipulation;
}

/* iPad対応 - アスペクト比 4:3（横向き） */
@media screen and (orientation: landscape) and (min-width: 768px) and (max-width: 1024px) {
    .container {
        max-width: 95%;
        margin: 0 auto;
    }
}

/* iPad対応 - アスペクト比 3:4（縦向き） */
@media screen and (orientation: portrait) and (min-width: 768px) and (max-width: 834px) {
    .container {
        max-width: 90%;
        margin: 0 auto;
    }
    
    .menu-grid {
        grid-template-columns: 1fr !important;
    }
    
    .menu-grid-input {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* ヘッダー */
header {
    background: #fffaf4;
    color: #f59714;
    padding: 30px 30px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    font-family: 'Roboto', sans-serif;
    margin: 0;
    text-shadow: 
        0 0 20px rgba(255, 255, 255, 0.2),
        0 0 35px rgba(255, 255, 255, 0.1),
        0 0 45px rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(255, 255, 255, 0.1),
        3px 3px 8px rgba(255, 255, 255, 0.1);
}

/* トップメニュー */
.top-menu {
    padding: 10px 30px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.menu-card {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 40px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.menu-card:hover, .menu-card:active {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.menu-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #6ee7b7 0%, #34d399 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(52, 211, 153, 0.25);
}

.menu-icon i {
    font-size: 2.5rem;
    color: var(--white);
}

.menu-card h2 {
    font-size: 1.75rem;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.menu-card p {
    color: var(--text-gray);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* ナビゲーションバー */
.nav-bar {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-back {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1.1rem;
}

/* 統一ページヘッダー */
.page-header {
    background: white;
    border-radius: 12px;
    padding: 15px 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    flex-shrink: 1;
    min-width: 0;
}

.page-header h1 i {
    color: #34d399;
    font-size: 26px;
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
    box-sizing: border-box;
}

.btn-primary {
    background: white;
    color: #6b7280;
    border: 2px solid #d1d5db;
    text-decoration: none !important;
}

.btn-primary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    text-decoration: none !important;
}

.btn-primary:visited {
    color: #6b7280;
    text-decoration: none !important;
}

.btn-secondary {
    background: white;
    color: #374151;
    border: 2px solid #e5e7eb;
    text-decoration: none !important;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    text-decoration: none !important;
}

.btn-secondary:visited {
    color: #374151;
    text-decoration: none !important;
}

.btn-success {
    background: linear-gradient(135deg, #6ee7b7 0%, #34d399 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 211, 153, 0.4);
    text-decoration: none !important;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 211, 153, 0.5);
    text-decoration: none !important;
}

.btn-success:visited {
    color: white;
    text-decoration: none !important;
}
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 8px;
    transition: background 0.3s;
}

.nav-back:hover, .nav-back:active {
    background: var(--light-bg);
}

.nav-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
}

/* メインコンテンツエリア */
.content {
    padding: 30px;
    min-height: calc(100vh - 200px);
}

/* ボタンスタイル */
.btn {
    padding: 16px 32px;
    border: none;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    touch-action: manipulation;
}

.btn-primary {
    background: white;
    color: #6b7280;
    border: 2px solid #d1d5db;
}

.btn-primary:hover, .btn-primary:active {
    background: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-secondary {
    background: var(--light-bg);
    color: var(--text-dark);
}

.btn-secondary:hover, .btn-secondary:active {
    background: var(--border-color);
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-large {
    padding: 20px 40px;
    font-size: 1.3rem;
    min-width: 200px;
}

/* 入力フォーム */
.form-group {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1.1rem;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    transition: border-color 0.3s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

/* カード */
.card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card-header {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

/* グリッドレイアウト */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* テーブル */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

table thead {
    background: var(--light-bg);
}

table th {
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    font-size: 1rem;
    font-family: 'Noto Sans JP', 'M PLUS Rounded 1c', sans-serif;
}

table td {
    padding: 12px 10px;
    text-align: center;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    font-family: 'Noto Sans JP', 'M PLUS Rounded 1c', sans-serif;
}

table td input,
table td select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.9rem;
}

/* タッチ最適化 */
button, .menu-card, .nav-back, select, input[type="number"], input[type="text"] {
    -webkit-user-select: none;
    user-select: none;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    height: 40px;
}

/* ローディング */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ユーティリティクラス */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mt-30 {
    margin-top: 30px;
}

.mb-20 {
    margin-bottom: 20px;
}

.flex {
    display: flex;
}

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

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-10 {
    gap: 10px;
}

.gap-20 {
    gap: 20px;
}

/* レスポンシブ調整 */
@media (max-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2.2rem;
    }
    
    .page-header {
        flex-wrap: wrap;
    }
    
    .page-header h1 {
        font-size: 20px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 14px;
    }
}
