@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&display=swap');

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

/* ===== Body — beer in a glass background ===== */
body {
    font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
    min-height: 100vh;
    color: #3a2a10;
    position: relative;
    overflow-x: hidden;
}

/* Foam zone (top) */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 35vh;
    background:
        radial-gradient(ellipse 120px 60px at 15% 85%, rgba(255,255,255,0.7) 0%, transparent 100%),
        radial-gradient(ellipse 100px 50px at 45% 90%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(ellipse 140px 65px at 75% 88%, rgba(255,255,255,0.6) 0%, transparent 100%),
        radial-gradient(ellipse 80px 40px at 90% 82%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(ellipse 90px 45px at 30% 78%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(ellipse 110px 55px at 60% 80%, rgba(255,255,255,0.45) 0%, transparent 100%),
        linear-gradient(180deg,
            #fff9ee 0%,
            #fff5e0 20%,
            #ffefc8 45%,
            #ffe8a8 70%,
            #fdd95e 100%);
    z-index: -2;
}

/* Beer body (bottom) */
body::after {
    content: '';
    position: fixed;
    top: 35vh;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(180deg,
            #fdd95e 0%,
            #f5c130 15%,
            #ebb020 40%,
            #e0a218 60%,
            #d4940f 80%,
            #c8880a 100%);
    z-index: -2;
}

/* Glass edge highlights — left & right */
body .container::before,
body .container::after {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: -1;
    pointer-events: none;
}

body .container::before {
    left: 0;
    background: linear-gradient(90deg,
        rgba(255,255,255,0.15) 0%,
        rgba(255,255,255,0.05) 40%,
        transparent 100%);
}

body .container::after {
    right: 0;
    background: linear-gradient(-90deg,
        rgba(255,255,255,0.08) 0%,
        transparent 100%);
}

/* Animated bubbles */
@keyframes bubbleRise {
    0% { transform: translateY(0) scale(1); opacity: 0.5; }
    50% { opacity: 0.3; }
    100% { transform: translateY(-100vh) scale(1.5); opacity: 0; }
}

.bubble {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.6), rgba(255,255,255,0.1));
    z-index: -1;
    pointer-events: none;
    animation: bubbleRise linear infinite;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 40px;
    position: relative;
}

/* ===== Header ===== */
header {
    text-align: center;
    padding: 16px 0 12px;
    margin-bottom: 12px;
    position: relative;
}

header::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2em;
    color: #5a3800;
    letter-spacing: 6px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
    position: relative;
}

.subtitle {
    color: #8a6820;
    font-size: 0.6em;
    margin-top: 4px;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.subtitle2 {
    color: #7a5a18;
    font-size: 0.65em;
    margin-top: 2px;
}

.motto {
    color: #6a4a10;
    font-size: 0.75em;
    margin-top: 6px;
    font-style: italic;
    opacity: 0.6;
    letter-spacing: 1px;
}

/* ===== Beer Glass Icon ===== */
.beer-glass-icon {
    margin-bottom: 4px;
    filter: drop-shadow(0 4px 16px rgba(180,120,20,0.3));
}

.beer-glass-icon svg {
    width: 40px;
    height: 46px;
}

header::after {
    content: '';
    display: block;
    width: 80px;
    height: 2px;
    margin: 8px auto 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), rgba(255,255,255,0.8), rgba(255,255,255,0.6), transparent);
    border-radius: 2px;
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}

.tab {
    flex-shrink: 0;
    padding: 8px 14px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.2);
    color: #6a5020;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.82em;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.tab.active {
    background: rgba(255,255,255,0.5);
    color: #4a3008;
    font-weight: bold;
    border-color: rgba(255,255,255,0.6);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.tab:hover:not(.active) {
    background: rgba(255,255,255,0.3);
    color: #5a4018;
}

/* ===== Cards — frosted glass ===== */
.card {
    background: rgba(255,255,255,0.25);
    border-radius: 20px;
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow:
        0 4px 24px rgba(0,0,0,0.06),
        inset 0 1px 0 rgba(255,255,255,0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 24px;
    right: 24px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(255,255,255,0.7),
        rgba(255,255,255,0.4),
        transparent);
    pointer-events: none;
}

.card h2 {
    font-size: 1em;
    margin-bottom: 10px;
    color: #5a3800;
    letter-spacing: 1px;
}

/* ===== Form ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85em;
    color: #8a6820;
    margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 10px;
    background: rgba(255,255,255,0.3);
    color: #3a2a10;
    font-size: 1em;
}

input:focus, select:focus {
    outline: none;
    border-color: rgba(255,255,255,0.7);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
}

/* ===== User buttons ===== */
.user-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.user-btn {
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 20px;
    background: rgba(255,255,255,0.15);
    color: #6a5020;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.user-btn.selected {
    border-color: #c88a10;
    background: rgba(200,138,16,0.15);
    color: #5a3800;
    font-weight: bold;
}

.user-btn:hover:not(.selected) {
    background: rgba(255,255,255,0.25);
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #e8a010, #fcc830, #fdd95e);
    color: #4a3008;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 12px rgba(200,138,16,0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 20px rgba(200,138,16,0.35);
}

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

.btn-secondary {
    padding: 8px 16px;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 8px;
    background: rgba(255,255,255,0.2);
    color: #6a5020;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-danger {
    display: block;
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid rgba(200,60,60,0.25);
    border-radius: 8px;
    background: rgba(200,60,60,0.08);
    color: #c04040;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-danger:last-child {
    margin-bottom: 0;
}

/* ===== Messages ===== */
.message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9em;
    display: none;
}

.message.success {
    display: block;
    background: rgba(255,255,255,0.35);
    color: #5a3800;
    border: 1px solid rgba(255,255,255,0.5);
}

.message.error {
    display: block;
    background: rgba(200,60,60,0.1);
    color: #c04040;
    border: 1px solid rgba(200,60,60,0.2);
}

/* ===== Rankings ===== */
.ranking-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.15);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.25);
    transition: all 0.2s;
}

.ranking-item:hover {
    transform: translateX(4px);
    background: rgba(255,255,255,0.25);
}

.ranking-position {
    font-size: 1.5em;
    min-width: 50px;
    text-align: center;
}

.ranking-info {
    flex: 1;
}

.ranking-name {
    font-weight: bold;
    font-size: 1.05em;
    color: #3a2a10;
}

.ranking-detail {
    font-size: 0.8em;
    color: #8a7040;
    margin-top: 2px;
}

.ranking-count {
    font-size: 1.4em;
    font-weight: bold;
    color: #7a4a00;
}

.ranking-unit {
    font-size: 0.7em;
    color: #8a7040;
    margin-left: 2px;
}

/* ===== Titles ===== */
.title-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.15);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.25);
}

.title-badge {
    font-size: 1.8em;
}

.title-name {
    font-weight: bold;
    color: #6a4200;
}

.title-holder {
    font-size: 0.85em;
    color: #8a7040;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-box {
    background: rgba(255,255,255,0.2);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.35);
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #6a4200;
}

.stat-label {
    font-size: 0.8em;
    color: #8a7040;
    margin-top: 4px;
}

/* ===== History ===== */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

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

.history-date {
    font-size: 0.8em;
    color: #8a7040;
}

.history-name {
    font-weight: bold;
    color: #3a2a10;
}

.history-count {
    font-size: 1.2em;
    font-weight: bold;
    color: #7a4a00;
}

.history-delete {
    background: none;
    border: none;
    color: #c04040;
    font-size: 1em;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.history-delete:hover {
    opacity: 1;
}

/* ===== Import ===== */
.import-preview {
    margin-top: 16px;
    padding: 16px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
}

.import-preview h3 {
    margin-bottom: 12px;
    color: #5a3800;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    margin: 12px 0;
}

.preview-table th, .preview-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.preview-table th {
    color: #5a3800;
}

.name-mapping-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.name-mapping-row input {
    flex: 1;
}

.name-mapping-row button {
    padding: 8px 12px;
    border: none;
    background: rgba(200,60,60,0.1);
    color: #c04040;
    border-radius: 8px;
    cursor: pointer;
}

/* ===== Help ===== */
.help-text {
    font-size: 0.8em;
    color: #7a6030;
    line-height: 1.4;
    margin-bottom: 8px;
}

.help-text code {
    background: rgba(255,255,255,0.3);
    padding: 2px 6px;
    border-radius: 4px;
    color: #5a3800;
}

.help-list {
    padding-left: 20px;
    font-size: 0.9em;
    color: #6a5020;
    line-height: 2;
}

/* ===== Tab content ===== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Danger zone ===== */
.danger-zone {
    border-color: rgba(200,60,60,0.2);
}

.danger-zone h2 {
    color: #c04040;
}

/* ===== Today summary ===== */
.today-record {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.today-record:last-child {
    border-bottom: none;
}

.today-emoji {
    font-size: 1.5em;
}

.today-name {
    flex: 1;
    font-weight: bold;
}

.today-count {
    font-size: 1.3em;
    font-weight: bold;
    color: #7a4a00;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(150,100,20,0.2);
    border-radius: 3px;
}

/* ===== Responsive ===== */
@media (max-width: 400px) {
    .container { padding: 12px; }
    header h1 { font-size: 1.8em; }
    .tab { padding: 6px 10px; font-size: 0.75em; }
}

/* ===== Quick Report ===== */
.quick-report {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick-report-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.quick-minus {
    width: 44px;
    flex-shrink: 0;
    border: 1px solid rgba(200,60,60,0.15);
    border-radius: 12px;
    background: rgba(200,60,60,0.06);
    color: #c04040;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
}

.quick-minus:disabled {
    opacity: 0.15;
    cursor: default;
}

.quick-minus:active:not(:disabled) {
    transform: scale(0.92);
    background: rgba(200,60,60,0.15);
}

.quick-report-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 16px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    color: #3a2a10;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 1em;
    position: relative;
    overflow: hidden;
}

/* Glass highlight on top edge */
.quick-report-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
}

.quick-report-btn:active {
    transform: scale(0.96);
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

.quick-report-btn .member-name {
    font-weight: bold;
    font-size: 1em;
}

.quick-report-btn .member-count {
    font-size: 1.2em;
    font-weight: bold;
    color: #7a4a00;
    min-width: 50px;
    text-align: right;
}

.quick-report-btn .plus-one {
    background: linear-gradient(135deg, #e8a010, #fcc830);
    color: #4a3008;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 1em;
    font-weight: bold;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(200,138,16,0.2);
}

.quick-report-btn.flash {
    animation: flashBeer 0.4s ease;
}

@keyframes flashBeer {
    0% {
        background: rgba(255,255,255,0.45);
        border-color: rgba(255,255,255,0.7);
        box-shadow: 0 0 20px rgba(252,210,80,0.2);
    }
    100% {
        background: rgba(255,255,255,0.15);
        border-color: rgba(255,255,255,0.3);
        box-shadow: none;
    }
}

/* ===== Bulk buttons ===== */
.bulk-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 8px 0;
}

.bulk-btn {
    width: 64px;
    height: 50px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    color: #6a4200;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
}

.bulk-btn:active {
    transform: scale(0.92);
    background: rgba(255,255,255,0.35);
}

.empty-state {
    text-align: center;
    padding: 24px;
    color: #8a7a50;
    font-size: 0.9em;
}

/* ===== Bunkai Toast ===== */
.bunkai-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: rgba(255,255,255,0.92);
    color: #5a3800;
    font-size: 1.3em;
    font-weight: bold;
    padding: 16px 32px;
    border-radius: 18px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 40px rgba(180,120,20,0.2);
    text-align: center;
    letter-spacing: 2px;
    border: 1px solid rgba(255,255,255,0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.bunkai-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.bunkai-toast.hide {
    opacity: 0;
    transform: translate(-50%, -60%) scale(0.8);
    transition: all 0.4s ease;
}
