/* ─── Discordochi Game Page ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body.dochi-body {
    margin: 0;
    min-height: 100vh;
    background: #1e2124;
    color: #e4e6eb;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ── Atmosphere ── */
.dochi-atmosphere {
    position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.13;
}
.blob-1 {
    width: 600px; height: 600px;
    background: #7289da;
    top: -200px; left: -150px;
    animation: drift1 18s ease-in-out infinite alternate;
}
.blob-2 {
    width: 500px; height: 500px;
    background: #9b59b6;
    bottom: -150px; right: -100px;
    animation: drift2 22s ease-in-out infinite alternate;
}
.blob-3 {
    width: 300px; height: 300px;
    background: #43b581;
    top: 50%; left: 55%;
    animation: drift3 15s ease-in-out infinite alternate;
}
@keyframes drift1 { from { transform: translate(0,0) scale(1); } to { transform: translate(60px, 80px) scale(1.1); } }
@keyframes drift2 { from { transform: translate(0,0) scale(1); } to { transform: translate(-50px, -60px) scale(1.15); } }
@keyframes drift3 { from { transform: translate(0,0) scale(1); } to { transform: translate(40px, -50px) scale(0.9); } }

/* ── Shell / layout ── */
.dochi-shell {
    position: relative; z-index: 1;
    max-width: 900px; margin: 0 auto; padding: 24px 16px 60px;
}

/* ── Header ── */
.dochi-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; margin-bottom: 28px;
}
.dochi-header h1 { margin: 0; font-size: 1.6rem; font-weight: 700; color: #fff; }
.dochi-header-actions {
    display: flex; align-items: center; justify-content: flex-end;
    flex-wrap: wrap; gap: 10px;
}
.dochi-guild-select {
    background: #1e2030; color: #e4e6eb; border: 1px solid #3a3f55;
    border-radius: 8px; padding: 8px 12px; font-size: .9rem; cursor: pointer;
    min-width: 200px;
}
.dochi-guild-select:focus { outline: 2px solid #7c5cbf; }
.dochi-back-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 39px; padding: 8px 14px;
    background: rgba(67, 181, 129, 0.12); color: #43b581;
    border: 1px solid #43b581; border-radius: 8px;
    text-decoration: none; font-size: .9rem; font-weight: 700;
    transition: background .2s, border-color .2s, color .2s;
}
.dochi-back-link:hover {
    background: rgba(67, 181, 129, 0.2);
    border-color: #5fd19b;
    color: #5fd19b;
}

/* ── Login notice ── */
.dochi-login-notice {
    background: #1e2030; border: 1px solid #3a3f55; border-radius: 12px;
    padding: 40px; text-align: center; color: #8b8fa8;
}
.dochi-login-notice a { color: #9b72e6; text-decoration: none; }
.dochi-login-notice a:hover { text-decoration: underline; }

.dochi-pause-notice {
    background: rgba(127, 29, 29, 0.72);
    border: 1px solid rgba(248, 113, 113, 0.4);
    border-radius: 12px;
    color: #fecaca;
    margin-bottom: 20px;
    padding: 14px 16px;
    font-size: .92rem;
    line-height: 1.45;
}

/* ── Pet card ── */
.dochi-pet-card {
    display: grid; grid-template-columns: 200px 1fr; gap: 0;
    background: #161824; border: 1px solid #2a2d42; border-radius: 14px;
    overflow: hidden; margin-bottom: 20px;
}
@media (max-width: 600px) { .dochi-pet-card { grid-template-columns: 1fr; } }

.dochi-avatar-wrap {
    background: #0f111a; position: relative;
    min-height: 200px; padding: 16px;
    display: flex; align-items: center; justify-content: center;
}
.dochi-avatar {
    width: 168px; height: 168px; border-radius: 12px; object-fit: cover;
    border: 2px solid #2a2d42; display: block;
}
.dochi-avatar[hidden] { display: none; }
.dochi-avatar-placeholder {
    width: 168px; height: 168px; border-radius: 12px;
    background: #1e2030; border: 2px dashed #3a3f55;
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem; color: #4a4f68;
}
.dochi-avatar-placeholder[hidden] { display: none; }
.dochi-status-badge {
    position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
    background: #0f111a; border: 1px solid #3a3f55; border-radius: 20px;
    padding: 3px 10px; font-size: .75rem; white-space: nowrap;
}

.dochi-pet-info { padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }

.dochi-pet-name {
    font-size: 1.4rem; font-weight: 700; color: #fff; margin: 0;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.dochi-level-badge {
    font-size: .8rem; font-weight: 600; background: #2a2048; color: #b08cff;
    border-radius: 20px; padding: 3px 10px;
}
.dochi-mood-tag {
    font-size: .85rem; background: #1e2030; border-radius: 8px; padding: 4px 10px;
    display: inline-flex; align-items: center; gap: 5px;
}

/* stat bars */
.dochi-stats-grid { display: flex; flex-direction: column; gap: 8px; }
.dochi-stat-row { display: flex; align-items: center; gap: 8px; }
.dochi-stat-label { min-width: 90px; font-size: .82rem; color: #8b8fa8; }
.dochi-bar-wrap {
    flex: 1; height: 10px; background: #2a2d42; border-radius: 6px; overflow: hidden;
}
.dochi-bar-fill {
    height: 100%; border-radius: 6px; transition: width .5s ease;
}
.dochi-bar-fill.hunger { background: linear-gradient(90deg,#e8703a,#f5a623); }
.dochi-bar-fill.hygiene { background: linear-gradient(90deg,#3abde8,#4fc3f7); }
.dochi-stat-val { min-width: 36px; font-size: .82rem; text-align: right; }

.dochi-coins-row {
    display: flex; gap: 16px; flex-wrap: wrap;
}
.dochi-coin-chip {
    background: #1e2030; border: 1px solid #2a2d42; border-radius: 8px;
    padding: 6px 14px; font-size: .88rem; display: flex; align-items: center; gap: 6px;
}
.dochi-coin-chip.bank { border-color: #4a3a18; background: #1c1a0a; }

.dochi-special-flags { display: flex; gap: 8px; flex-wrap: wrap; }
.dochi-flag {
    font-size: .78rem; border-radius: 6px; padding: 3px 9px;
    display: flex; align-items: center; gap: 4px;
}
.dochi-flag.sick { background: #2d1a1a; color: #f87171; border: 1px solid #5c2a2a; }
.dochi-flag.sleeping { background: #1a1a3d; color: #818cf8; border: 1px solid #2a2a6d; }
.dochi-flag.working { background: #1a2a1a; color: #86efac; border: 1px solid #2a5a2a; }
.dochi-flag.nanny { background: #2d1a2d; color: #f0abfc; border: 1px solid #5c2a5c; }
.dochi-flag.treasure { background: #2d2a1a; color: #fcd34d; border: 1px solid #5c4a1a; }

/* ── No pet notice ── */
.dochi-no-pet {
    background: #161824; border: 1px solid #2a2d42; border-radius: 14px;
    padding: 40px; text-align: center; color: #8b8fa8; margin-bottom: 20px;
}

/* ── Action toolbar ── */
.dochi-toolbar {
    display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px;
}
.dochi-btn {
    padding: 10px 18px; border-radius: 8px; border: none; cursor: pointer;
    font-size: .9rem; font-weight: 600; transition: opacity .15s, transform .1s;
    display: flex; align-items: center; gap: 6px;
}
.dochi-btn:hover:not(:disabled) { opacity: .88; transform: translateY(-1px); }
.dochi-btn:active:not(:disabled) { transform: translateY(0); }
.dochi-btn:disabled { opacity: .35; cursor: not-allowed; }

.dochi-btn.feed   { background: #2d6a2d; color: #bbf7d0; }
.dochi-btn.wash   { background: #1a4a7a; color: #bae6fd; }
.dochi-btn.walk   { background: #3a3a1a; color: #fef08a; }
.dochi-btn.sleep  { background: #1e1e4a; color: #c7d2fe; }
.dochi-btn.job    { background: #2a2a1a; color: #d9f99d; }
.dochi-btn.dig    { background: #3a2a1a; color: #fed7aa; }
.dochi-btn.shop   { background: #3a1a3a; color: #f0abfc; }
.dochi-btn.bank   { background: #3a2a1a; color: #fcd34d; }

/* ── Collapsible panels ── */
.dochi-panel {
    background: #161824; border: 1px solid #2a2d42; border-radius: 12px;
    margin-bottom: 16px; overflow: hidden;
}
.dochi-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; cursor: pointer; user-select: none;
    font-weight: 600; font-size: .95rem;
}
.dochi-panel-header:hover { background: #1a1e30; }
.dochi-panel-chevron { transition: transform .2s; font-size: .8rem; color: #6b7280; }
.dochi-panel.open .dochi-panel-chevron { transform: rotate(180deg); }
.dochi-panel-body { padding: 16px 18px; display: none; }
.dochi-panel.open .dochi-panel-body { display: block; }

/* ── Shop panel ── */
.dochi-shop-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 12px;
}
.dochi-shop-item {
    background: #1e2030; border: 1px solid #2a2d42; border-radius: 10px;
    padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.dochi-shop-item-name { font-weight: 600; font-size: .9rem; }
.dochi-shop-item-cost { font-size: .8rem; color: #fcd34d; }
.dochi-shop-item-desc { font-size: .78rem; color: #8b8fa8; flex: 1; }
.dochi-shop-item .dochi-btn { width: 100%; justify-content: center; margin-top: auto; }

/* rename/redescibe input */
.dochi-input-row {
    display: flex; gap: 8px; margin-top: 8px;
}
.dochi-input {
    flex: 1; background: #0f111a; border: 1px solid #3a3f55; border-radius: 7px;
    color: #e4e6eb; padding: 8px 12px; font-size: .88rem;
}
.dochi-input:focus { outline: 2px solid #7c5cbf; border-color: transparent; }

/* ── Bank panel ── */
.dochi-bank-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
@media (max-width: 560px) { .dochi-bank-grid { grid-template-columns: 1fr; } }
.dochi-bank-stat {
    background: #1e2030; border: 1px solid #2a2d42; border-radius: 10px; padding: 14px;
}
.dochi-bank-stat-label { font-size: .78rem; color: #8b8fa8; margin-bottom: 4px; }
.dochi-bank-stat-val { font-size: 1.1rem; font-weight: 700; color: #fcd34d; }
.dochi-bank-ops { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.dochi-bank-op-row { display: flex; gap: 8px; }
.dochi-bank-op-row .dochi-input { max-width: 120px; }

/* ── Achievements grid ── */
.dochi-ach-grid {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.dochi-ach-badge {
    background: #1e2030; border: 1px solid #2a2d42; border-radius: 8px;
    padding: 6px 10px; font-size: .82rem; display: flex; align-items: center; gap: 6px;
    cursor: default; position: relative;
}
.dochi-ach-badge.earned { border-color: #5c4a18; background: #221d08; }
.dochi-ach-badge.earned .dochi-ach-name { color: #fde68a; }
.dochi-ach-badge.locked { opacity: .4; }
.dochi-ach-name { font-weight: 600; }

/* ── Leaderboard / dead list ── */
.dochi-table {
    width: 100%; border-collapse: collapse; font-size: .85rem;
}
.dochi-table th {
    text-align: left; padding: 8px 10px; color: #6b7280;
    border-bottom: 1px solid #2a2d42; font-weight: 600; font-size: .78rem;
}
.dochi-table td {
    padding: 8px 10px; border-bottom: 1px solid #1e2030;
    vertical-align: middle;
}
.dochi-table tr:last-child td { border-bottom: none; }

/* ── Toast ── */
.dochi-toast-area {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    display: flex; flex-direction: column-reverse; gap: 10px; pointer-events: none;
}
.dochi-toast {
    background: #1e2030; border: 1px solid #3a3f55; border-radius: 10px;
    padding: 12px 18px; font-size: .88rem; max-width: 340px;
    box-shadow: 0 4px 20px rgba(0,0,0,.5);
    animation: toastIn .25s ease; pointer-events: auto;
}
.dochi-toast.ok  { border-left: 3px solid #22c55e; }
.dochi-toast.err { border-left: 3px solid #ef4444; }
.dochi-toast.info{ border-left: 3px solid #7c5cbf; }
@keyframes toastIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:none} }

/* ── Spinner ── */
.dochi-spinner {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.2); border-top-color: #fff;
    border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cooldown indicator ── */
.dochi-cooldown {
    font-size: .72rem; color: #f59e0b; margin-top: 2px;
}

/* ── Dialog ─────────────────────────────────────────────────────────────── */
.dochi-dialog {
    background: #1e2030;
    color: #e4e6eb;
    border: 1px solid #3a3f55;
    border-radius: 14px;
    padding: 24px 28px 20px;
    min-width: 300px;
    max-width: 440px;
    width: 90vw;
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.dochi-dialog::backdrop {
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(4px);
}
.dochi-dialog h3 {
    margin: 0 0 6px;
    font-size: 1.1rem;
    color: #c9b8ff;
}
.dochi-dialog-sub {
    font-size: .83rem;
    color: #8b8fa8;
    margin: 0 0 14px;
}
.dochi-dialog .dochi-input {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
}
.dochi-dialog-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 14px;
}
