/* ===== Color tokens (blue & white) ===== */
:root {
    --bg: #F7FAFF;
    --card: #FFFFFF;
    --ink: #0F172A;
    --ink-weak: #475569;
    --line: #DCE7FF;
    --primary: #3A7BFF;
    --primary-hover: #2C63D6;
    --accent: #00B3FF;
    --shadow: 0 6px 20px rgba(16, 24, 40, .10);
    --radius: 16px;
}

/* ===== Reset (minimal) ===== */
* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
}

img {
    max-width: 100%;
    display: block
}

h1,
h2,
h3 {
    margin: 0 0 .5rem 0;
    line-height: 1.25
}

p {
    margin: .25rem 0
}

/* ===== Header ===== */
.header {
    max-width: 1200px;
    margin: 24px auto 20px;
    padding: 20px 24px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 28px
}

.header p {
    color: var(--ink-weak);
    font-size: 14px
}

/* ===== Main layout ===== */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 12px 48px;
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* 左：設定パネル群 / 右：結果 */
    gap: 20px;
}

span.input-hint {
    display: block;
    margin-top: 8px;
    color: var(--ink-weak);
    font-size: 8px;
}

/* ===== Panels ===== */
.setting-panel,
.result-panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}

/* 左大パネル内は 3 カラム */
.setting-panel {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    align-items: start;
}

/* 小パネル（内枠） */
.setting-panel-inner,
.result-panel-inner {
    background: linear-gradient(#ffffff, #ffffff) padding-box,
        linear-gradient(180deg, rgba(218, 233, 255, .9), rgba(218, 233, 255, 0)) border-box;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    height: 100%;
}

/* ===== Member input column ===== */
.setting-panel h2,
.result-panel h2 {
    font-size: 20px;
    margin-bottom: 12px;
}


.member-input input[type="text"] {
    width: 100%;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 12px;
    outline: none;
    background: #fff;
}

.member-input input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(58, 123, 255, .15);
}

.member-input button {
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0 14px;
    background: #fff;
    cursor: pointer;
    margin-top: 10px;
}

.member-input button:hover {
    border-color: var(--primary)
}

#member-list {
    margin-top: 12px;
    padding: 10px;
    min-height: 140px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: #FBFDFF;
    color: var(--ink-weak);
    font-size: 14px;
}

.member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
}

.member-item:last-child {
    border-bottom: none;
}

.member-item .member-name {
    flex: 1;
    font-size: 14px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 12ch;
}

.member-item button {
    background: transparent;
    border: solid 2px var(--line);
    color: var(--primary);
    cursor: pointer;
    border-radius: 8px;
}

.member-item button:hover {
    border-color: var(--primary);
    color: var(--primary-hover);
}



/* ===== Grouping settings column ===== */
.grouping-settings label {
    margin-right: 8px
}

.grouping-settings input[type="number"] {
    width: 8ch;
    height: 40px;
    border: none;
    border-bottom: 2px solid var(--line);
    text-align: right;
    padding: 0 12px;
    background: transparent;
    outline: none;
}

.grouping-settings input[type="number"]:focus {
    border-bottom-color: var(--primary);
    box-shadow: 0 2px 0 0 var(--primary);
}

.grouping-settings span {
    margin-left: 8px;
    color: var(--ink-weak)
}

/* ===== Action column ===== */
.action-buttons {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    height: 100%;
}

.primary {
    height: 44px;
    padding: 0 18px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(58, 123, 255, .25);
}

.primary:hover {
    background: var(--primary-hover)
}

.primary:active {
    transform: translateY(1px)
}

/* ===== Results panel ===== */
.result-panel-inner {
    min-height: 520px
}

#groupingResult {
    margin-top: 12px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* チームカード（JSで生成する想定） */
.team-item {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
}

.team-name {
    font-weight: 700;
    margin-bottom: 8px;
}

.team-members {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

}

.team-member {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #F3F8FF;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 32ch;
}

/* ===== Help / Footer ===== */
.help {
    grid-column: 1 / -1;
    margin-top: 6px;
    padding: 16px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.help h2 {
    font-size: 20px;
    margin-bottom: 12px;
}

.help dl {
    margin: 0;
}

.help dt {
    font-weight: 300;
}

.help dd {
    margin-bottom: 8px;
    color: var(--ink-weak);
    font-size: 14px;
}

footer {
    max-width: 1200px;
    margin: 16px auto 40px;
    padding: 8px 12px;
    color: var(--ink-weak);
    font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    main {
        grid-template-columns: 1fr
    }

    .result-panel {
        order: 2
    }

    .help {
        order: 3
    }
}

@media (max-width: 840px) {
    .setting-panel {
        grid-template-columns: 1fr
    }

    .action-buttons {
        justify-content: flex-start
    }
}